/javascript-algorithms

JavaScript frequently used algorithms.

Primary LanguageJavaScriptMIT LicenseMIT

QuickSort implemented using JavaScript in 45 lines.

simple sort
5, 2, 9, 4, 6, 2, 2, 3, 1
1, 2, 2, 2, 3, 4, 5, 6, 9

array bellow was not working... so, i'll let here for testing.
test1: are equal = true

sorting an already sorted array not shuffles anything?
test2: are equal = true

okay, lets compare the sort with big lists and the default javascript array sort.
Array Size = 10000000
Took '3706ms' with native sort
Took '1071ms' with custom sort
test3: are equal = true

How to use

git clone https://github.com/vinipickrodt/javascript-algorithms.git
cd javascript-algorithms
node --max-old-space-size=8192 qsort_test.js