bogobogo
v0.1.0
Published
Simple implementation of Bogobogosort
Downloads
2
Maintainers
Readme
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 = require('bogobogo');
bogobogo.create([66, 22, 3, 5, 1, 19]).then(function(result){
console.log(result);
}).start();
License
MIT © Falkirks