Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cheljoh/b16ab17e613b908ff8e58039fda094fd to your computer and use it in GitHub Desktop.
Save cheljoh/b16ab17e613b908ff8e58039fda094fd to your computer and use it in GitHub Desktop.

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?"

  • The .sort() is lexographical, so 10 comes before 7.
  • Three important characteristics:
  • stability- maintain relative order
  • runtime anaylsis
  • algorithm implementationStable sorts maintain
  • Bubble sort- have to check through every item- two for loops and an if statement. Easy to implement
  • Merge sort- fast and stable but needs resources for temp space
  • Insertion- doesn't need that many resources, but slow when data is reverse ordered.

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