ljz

1.0.5 • Public • Published

Table of Contents generated with DocToc

ljzjs

Build Status

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 ...

/ljz/

    Package Sidebar

    Install

    npm i ljz

    Weekly Downloads

    3

    Version

    1.0.5

    License

    MIT

    Last publish

    Collaborators

    • yt_fan