is a moderately well-known algorithm to sort a list. Here’s how it works:
- Put the elements of the list in a random order.
- Check if the list is sorted. If not, start over.
BogoSort has an average running time of O((n+1)!), which is not very good. It is also the rare algorithm which has NO worst-case running time; if the input has at least two elements, it is possible for the algorithm to run for any amount of time.