0.3.0 • Published 10 years ago

sort-algo v0.3.0

Weekly downloads
48
License
-
Repository
-
Last release
10 years ago

Insertion sort

Complexity : worst : n2 , average n2 , best n where n is the number of elements in the given array

Fast algorithm if the array contain a maximum of 15 elements.

var insertion = require('sort-algo').insertion;

var array  = [ 4 , 6 , 3 , 7 , 1 , 9 , 2 ] ;

insertion(array);
// return [ 1 , 2 , 3 , 4 , 6 , 7 , 9 ]

Quick sort

Complexity : worst : n2 , average n log n , best n log n where n is the number of elements in the given array

cf : wiki Quick sort

var quickSort = require('sort-algo').quick;

var array  = [ 4 , 6 , 3 , 7 , 1 , 9 , 2 ] ;

quickSort(array);
// return [ 1 , 2 , 3 , 4 , 6 , 7 , 9 ]
0.3.0

10 years ago

0.2.6

10 years ago

0.2.5

10 years ago

0.2.4

10 years ago

0.2.3

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.2

11 years ago

0.1.1

11 years ago

0.1.0

11 years ago