Are there any worse sorting algorithms than Bogosort (a.k.a Monkey Sort)?
Posted
by womp
on Stack Overflow
See other posts from Stack Overflow
or by womp
Published on 2010-04-09T18:24:09Z
Indexed on
2010/04/09
18:53 UTC
Read the original article
Hit count: 472
My co-workers took me back in time to my University days with a discussion of sorting algorithms this morning. We reminisced about our favorites like StupidSort, and one of us was sure we had seen a sort algorithm that was O(n!)
. That got me started looking around for the "worst" sorting algorithms I could find.
We postulated that a completely random sort would be pretty bad (i.e. randomize the elements - is it in order? no? randomize again), and I looked around and found out that it's apparently called BogoSort, or Monkey Sort, or sometimes just Random Sort.
Monkey Sort appears to have a worst case performance of O(∞), a best case performance of O(n)
, and an average performance of O(n * n!)
.
Are there any named algorithms that have worse average performance than O(n * n!)
? Or are just sillier than Monkey Sort in general?
© Stack Overflow or respective owner