A few weeks ago, I decided to brush up on my sorting algorithms by implementing five of the most common sorts.
There are TONS of great resources online for learning these algorithms, including Wikipedia, and, my favorite: http://www.sorting-algorithms.com/
To check out my JavaScript implementations of bubbleSort
, insertionSort
, selectionSort
, mergeSort
, and quickSort
, head over to my js-sorting GitHub repository.
While you're there, it may be worth taking a look at the tests I set up for the project, using Grunt, PhantomJS, Jasmine, and TestEm.