Bogosort (also permutation sort, and rather succinctly stupid sort) is a sorting algorithm that successively randomises (i.e., it generates permutations) a set until it finds one that is sorted.

For obvious reasons this isn’t useful. In its worst-case performance, we get a time complexity of and a best-case of . The extra terms come from the permuting itself. If we ignore the permutation operation, the algorithm reduces down to and , respectively.