Step One: Watch Sorting Algorithms in JavaScript
Step Two: Fork this gist.
Step Three: Respond to this question in your fork: "What are some of the balances and trade offs between different sorting algoritms?"
- Bubble sort is just the slowest one ever. It checks every single element all the time. No bueno
- Merge sort is the best. Requires more memory for storing sorted left and right arrays, but the speed is much faster
- Insertion sort is good for arrays that are not too unsorted and remains fast until the order/size is to unordered/big
Step Four: Totally Optional: take a look at some of the other forks and comment if the spirit moves you.