0.3.0 • Published 8 years ago

algojs-sorting v0.3.0

Weekly downloads
5
License
UNLICENSED
Repository
github
Last release
8 years ago

algojs-sorting

Best sorting algorithms on Javascript arrays.

npm version Build Status Coverage Status

API docs

API docs published here.

var algojs = require('algojs-sorting');

var arr = [88,24,33,2,12,9];
algojs.quickSort(arr);

// --> arr is sorted!

Algorithms

in place?stableworseaveragebest
selectionSortxN^2 / 2N^2 / 2N^2 / 2
insertionSortxxN^2 / 2N^2 / 4N
shellSortx??N
mergeSortxN * logNN * logNN * logN

Selection Sort

Array is sorted as side effect in average quadratic time. See selection sort.

algojs.selectionSort(arr);

Insertion Sort

Array is sorted as side effect in average quadratic time (but linear in best case). See insertion sort.

algojs.insertionSort(arr);

Shell Sort

Array is sorted as side effect in unknown average time (but linear in best case). See shell sort

algojs.shellSort(arr);

Merge Sort

Array is sorted as side effect in linearithmic time. See merge sort

algojs.shellSort(arr);
0.3.0

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.1

8 years ago