ljz
v1.0.5
Published
javascript sort function
Downloads
9
Readme
Table of Contents generated with DocToc
ljzjs
javascript sort function, include bubble sort, insert sort, quick sort
usage
'use strict';
var bubble = require("ljz").bubbleSort;
var insert = require("ljz").insertSort;
var quick = require("ljz").quickSort;
var shell = require("ljz").shellSort;
var arr = [1, 4, 2, 7, 9, 6, 5, 10, 3, 100, 102, 101, 23, 34, 45, 43, 32, 4];
console.log("bubble => ", bubble(arr));
console.log("insert => ", insert(arr));
console.log("quick => ", quick(arr));
console.log("shell => ", shell(arr));
$ bubble => [ 1, 2, 3, 4, 4, 5, 6, 7, 9, 10, 23, 32, 34, 43, 45, 100, 101, 102 ]
$ insert => [ 1, 2, 3, 4, 4, 5, 6, 7, 9, 10, 23, 32, 34, 43, 45, 100, 101, 102 ]
$ quick => [ 1, 2, 3, 4, 4, 5, 6, 7, 9, 10, 23, 32, 34, 43, 45, 100, 101, 102 ]
$ shell => [ 1, 2, 3, 4, 4, 5, 6, 7, 9, 10, 23, 32, 34, 43, 45, 100, 101, 102 ]
test
$ npm test
TODO
- more sort function, comb sort ...