update meta data
This commit is contained in:
parent
f3a896c724
commit
90e15ed6ce
3307 changed files with 1674 additions and 7 deletions
11
Task/Sorting-algorithms-Bogosort/00DESCRIPTION
Normal file
11
Task/Sorting-algorithms-Bogosort/00DESCRIPTION
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{{Sorting Algorithm}}
|
||||
[[wp:Bogosort|Bogosort]] a list of numbers. Bogosort simply shuffles a collection randomly until it is sorted.
|
||||
|
||||
"Bogosort" is a perversely inefficient algorithm only used as an in-joke. Its average run-time is O(n!) because the chance that any given shuffle of a set will end up in sorted order is about one in ''n'' factorial, and the worst case is infinite since there's no guarantee that a random shuffling will ever produce a sorted sequence. Its best case is O(n) since a single pass through the elements may suffice to order them.
|
||||
|
||||
Pseudocode:
|
||||
'''while not''' InOrder(list) '''do'''
|
||||
Shuffle(list)
|
||||
'''done'''
|
||||
|
||||
The [[Knuth shuffle]] may be used to implement the shuffle part of this algorithm.
|
||||
Loading…
Add table
Add a link
Reference in a new issue