Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: O(1) garbage

Author: David Rasmussen

Date: 00:48:04 05/16/01

Go up one level in this thread


>On May 15, 2001 at 19:42:23, Dann Corbit wrote:
>
>Urp, I was thinking of n^n.  Of course, there are O(n^2) algorithms for
>sorting.
>I've already got a basket of them.  Having another bad math day.  I think I
>need to go and play some basketball.
>

I once invented a sort algorithm that goes like this:

Pick to random elements and swap them if necessary, according to order. Check if
the set is sorted. If it isn't, repeat.

I call it Haystack Sort. Others may have "invented" this long before me :)

The worst case runtime complexity for this is infinite, because we can't be sure
it terminates. The average case runtime complexity is O(n!) which is O(n^n).



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.