Meet people who work on similar things as you – get help if you need it
Join Siafoo Now
or
Learn More
BogoSort
Revision 3 vs. Revision 4
Legend:
 Unmodified
 Added
 Removed

Description
r3 r4 1 1 BogoSort is a highly ineffective algorithm notable only for its comedic value. 2 2 3 3 The primary loop checks whether the input array is properly sorted and randomizes the entire array if it is not. 4 4 5 An analogy would be painting numbers on goldfish in a pond, counting the order in which the fish cross under a bridge, and dropping a **grenade** into the water whenever don't happen to like that order. 6 7 In other words, you'd have to be *crazy* to implement this algorithm. 8 9 To put that mathematically, the worst case scenario is that the algorithm takes an **infinite** amount of time to resolve. Even looking at "average case" values, the expected number of swaps is :math:`(n1)n!` and the expected number of valuecomparisons is :math:`(e1)n! + O(1)` . 5 An analogy would be painting numbers on goldfish in a pond, counting the order in which the fish cross under a bridge, and dropping a **grenade** into the water whenever don't happen to like that order.In other words, you'd have to be *crazy* to implement this algorithm. Mathematically, the worst case scenario is that the algorithm takes an **infinite** amount of time to resolve. Even looking at "average case" values, the expected number of swaps is :math:`(n1)n!` and the expected number of valuecomparisons is :math:`(e1)n! + O(1)` .