2.6.9 • Published 7 years ago

random-sort v2.6.9

Weekly downloads
3
License
Apache-2.0
Repository
github
Last release
7 years ago

Random Sort

Time inconsistent sorting algorithm based on array shuffling!

Implementation of the Bogosort (also permutation sort, stupid sort, slowsort, shotgun sort or monkey sort) algorithm.

Average performance: O((n+1)!)

Build status NPM GitHub issues GitHub license GitHub contributors GitHub pull requests GitHub closed pull requests

NPM

Installation

npm install --save random-sort

Usage

const sort = require('random-sort');
const array = [1, 7, 2, 4, 9, 3];

sort(array);

// [ 1, 2, 3, 4, 7, 9]
console.log(array);

API

sort<T>(array: T[], compare?: Function)

Sorts the array array in place, optionally with the provided compare function compare.

Visualization

Youtube Bogo Sort

2.6.9

7 years ago

2.6.4

7 years ago

2.5.3

7 years ago

2.5.1

7 years ago

2.4.12

7 years ago

2.4.11

7 years ago

2.4.9

7 years ago

2.4.8

7 years ago

2.3.7

7 years ago

2.3.0

7 years ago

2.1.0

7 years ago