optimized-quicksort
v1.1.1
Published
Optimized version of quicksort.
Downloads
13
Maintainers
Readme
optimized-quicksort
Optimized version of quicksort. Dual-pivot implementation with insertion sort optimization.
Installation
$ npm install optimized-quicksort
Quick start
var Quicksort = require('optimized-quicksort');
function myCompareFn(a, b) {
if (a < b) return -1;
else if (a > b) return 1;
else return 0;
}
var array = [1,9,2,8,3,7,4,6,5];
Quicksort.sort(array, myCompareFn);
Performance
npm run performance
Sort 1000 tables each 10000 elements
Quicksort time: 761ms
Array.sort() time: 1972ms
Licence
MIT