Sorting code bricks for JavaScript. Parent is aureooms/js-algo.
let fordjohnson = sort._fordjohnson( search.binarysearch ) ;Can be managed through jspm, duo, component, bower, ender, jam, spm, and npm.
jspm install github:aureooms/js-sort # or jspm install npm:aureooms-js-sort No install step needed for duo!
component install aureooms/js-sort bower install aureooms-js-sort ender add aureooms-js-sort jam install aureooms-js-sort spm install aureooms-js-sort --save npm install aureooms-js-sort --save let sort = require( "github:aureooms/js-sort" ) ; // or import sort from 'aureooms-js-sort' ;let sort = require( "aureooms/js-sort" ) ;let sort = require( "aureooms-js-sort" ) ;The script tag exposes the global variable sort.
<script src="bower_components/aureooms-js-sort/js/dist/sort.min.js"></script>Alternatively, you can use any tool mentioned here.
require( [ "aureooms-js-sort" ] , function ( sort ) { ... } ) ;This package has several children:
- aureooms/js-bucketsort: bucketsort code bricks for JavaScript
- aureooms/js-countingsort: countingsort code bricks for JavaScript
- aureooms/js-in-situ-sort-spec: in place sorting code bricks for JavaScript
- aureooms/js-heapsort: heapsort code bricks for JavaScript
- aureooms/js-quicksort: quicksort code bricks for JavaScript
- aureooms/js-mergesort: mergesort code bricks for JavaScript
- aureooms/js-merging: merging code bricks for JavaScript
- aureooms/js-partition: partition code bricks for JavaScript
- aureooms/js-radixsort: radixsort code bricks for JavaScript
- aureooms/js-selection: selection code bricks for JavaScript
- aureooms/js-odd-even-mergesort: Batcher's odd-even mergesort code bricks for JavaScript
let array = require( "aureooms-js-array" ) ; let search = require( "aureooms-js-search" ) ; let compare = require( "aureooms-js-compare" ) ; let fordjohnson = function ( compare , a , i , j ) { sort._fordjohnson( search.binarysearch )( compare , array.swap , a , i , j ) ; } ; let a = [ 1 , 6 , 5 , 3 , 2 , 4 ] ; fordjohnson( compare.increasing , a , 0 , a.length ) ; a ; // [ 1 , 2 , 3 , 4 , 5 , 6 ] fordjohnson( compare.decreasing , a , 0 , a.length ) ; a ; // [ 6 , 5 , 4 , 3 , 2 , 1 ] // but also /** insertionsort */ let insertionsort = sort.insertionsort ; /** selectionsort */ let selectionsort = sort.selectionsort ; /** bubblesort */ let bubblesort = sort.bubblesort ;