bogobogo
Simple implementation of Bogobogosort
NOTE: For obvious reasons, there isn't a clear document describing how Bogobogosort works. This implmentation includes both popular versions with the default being the slower one.
Slow (default)
- Get first
n
(n
starts at 2) items of list. - Shuffle
n
items (uses Fisher-Yates shuffle). - If
n
items are not sorted, setn
back to 2. If they are sorted, thenn
increases by one unlessn
already includes the whole array, in which case, the sort is finished. - Return to step 1.
"Fast"
- Get first
n
(n
starts at 2) items of list. - Shuffle
n
items (uses Fisher-Yates shuffle). - If
n
items are not sorted, return to step 2. - If
n
includes who array then sort is finished, if not, increasen
by one and return to step 1.
Install
$ npm install --save bogobogo
Usage
var bogobogo = ; bogobogostart;
License
MIT © Falkirks