User Tools

Site Tools

This is an old revision of the document!


Bogosort (also stupid sort or slowsort) is a particularly ineffective sorting algorithm based on the generate and test paradigm. It is not useful for sorting, but may be used for educational purposes, to contrast it with other more realistic algorithms.

Bogosort takes on average $n!$ attempts to select the right answer. Since each isSorted and shuffle are $O(n)$, bogosort takes $O(n.n!)$ time overall. The extreme time complexity is the reason this example is only sorting 5 items.

λ bogosort

bogosort.1398636861.txt.gz · Last modified: 2015/02/02 08:24 (external edit)