Skip to content

Instantly share code, notes, and snippets.

@MattRooney
Forked from stevekinney/gist:9e9cfeb225c8133fda73
Last active February 16, 2016 22:05
Show Gist options
  • Save MattRooney/bd878687641d3c5249f5 to your computer and use it in GitHub Desktop.
Save MattRooney/bd878687641d3c5249f5 to your computer and use it in GitHub Desktop.
**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?"
- Runtime (Big O) - Insertion and Bubble are slow, O(n^2). Merge is fast, O(n log n).
- Stability - stable sorts maintain the relative order of items with equal "values" (ex. Alex, before Adam when sorted on A). Insertion and Merge sort are stable, bubble sort is not.
- Implementation - none of them are that hard to implement.
While Merge is fast and stable, it requires a lot of resources. Bubble sort is not so great (slow and unstable). Insertion is a bit slow, but stable and requires little resources.
**Step Four**: _Totally Optional_: take a look at some of the other forks and comment if the spirit moves you.
@rrgayhart
Copy link

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment