logoalt Hacker News

mesrik • today at 11:09 AM • 0 replies • view on HN

Well, mostly yes though some are less effective and may surprise time it takes to complete :)

https://en.wikipedia.org/wiki/Bogosort

"Two versions of this algorithm exist: a deterministic version that enumerates all permutations until it hits a sorted one, and a randomized version that randomly permutes its input and checks whether it is sorted.

An analogy for the working of the latter version is to sort a deck of cards by throwing the deck into the air, picking the cards up at random, and repeating the process until the deck is sorted. In a worst-case scenario with this version, the random source is of low quality and happens to make the sorted permutation unlikely to occur."