Skip to content

Instantly share code, notes, and snippets.

@Kealii
Forked from stevekinney/gist:9e9cfeb225c8133fda73
Last active February 16, 2016 22:07
Show Gist options
  • Save Kealii/8b60e7d881d6cb743210 to your computer and use it in GitHub Desktop.
Save Kealii/8b60e7d881d6cb743210 to your computer and use it in GitHub Desktop.

What are some of the balances and trade offs between different sorting algoritms?

####Bubble Sort - Ideal for small lists or large lists that are almost in order. #####Pros

  • Great with almost sorted lists
  • Memory Cheap

#####Cons

  • Slow

####Insertion Sort - Ideal for mosts lists. Not many different moving parts so there's less room for serious hidden mistakes. #####Pros

  • Quick
  • Simple

#####Cons

  • Memory Moderate

####Merge Sort - Ideal for large lists. Lots of moving parts which improves speed but more error prone. #####Pros

  • Little wasted 'motion'
  • Speed scales well

#####Cons

  • Memory Expensive
@rrgayhart
Copy link

👍

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