Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ksk5280/63debf5b3989a324da871b4112700a76 to your computer and use it in GitHub Desktop.
Save ksk5280/63debf5b3989a324da871b4112700a76 to your computer and use it in GitHub Desktop.
Sorting Algorithms
**Step One**: Watch [Sorting Algorithms in JavaScript](https://www.youtube.com/watch?v=uRyqlhjXYQI)
**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 very slow. It's mostly used for instructional purposes to show as a comparison to the other sorting methods.
Insertion sort is simple and doesn't require using a lot of space, so it can be a good algorithm to use if there's a limit in how much memory you have. It's relatively fast for a small amount of data.
Merge sort is fast but requires more memory than insertion sort, which you might not have.
Another consideration is the stability of an algorithm, which means that the order of sorting is maintained for items that have the equal values. Merge sort and insertion sort are stable algorithms.
There are many other sorting methods out there to try, including shell, quicksort, cocktail, heapsort, counting, comb, bucket, radix, shear, shuttle, and lucky.
**Step Four**: _Totally Optional_: take a look at some of the other forks and comment if the spirit moves you.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment