Skip to content

Instantly share code, notes, and snippets.

@shirts
Created September 20, 2017 19:09
Show Gist options
  • Save shirts/7a51c5fd4990d780da419cdcd103ee82 to your computer and use it in GitHub Desktop.
Save shirts/7a51c5fd4990d780da419cdcd103ee82 to your computer and use it in GitHub Desktop.
BIG O
O(1) = Immediately know exactly which element to visit (array by index, hash table lookup)
O(n) = Visit element once (find something in a list of unique values)
O(log n) = Loop the whole list multiple times but reduce its size each iteration roughly by half (sorting algorithms like quick sort [or is it merge sort]?)
O(n^2) = Loop the whole list for each element in the list (nested loops) (edited)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment