complexity

Estimated reading time: 1 minute

complexity

  • worst case
  • best case
  • average case

efficiency

  • time complexity (process time)
  • space complexity (memory)

big O notation

big O notation is worst case.

O(1) < O(log(N)) < O(N) < O(Nlog(N)) <O(N^2)

  • find the fasted growing term
  • take out the coefficient

N*O(1) + O(1) = O(N)

~ TIPS O(1) + O(1) = C1 + C2 = C3 = C3 * 1 = O(1)

cheatshet

  • https://github.com/sf-wdi-31/algorithm-complexity-and-big-o
  • https://github.com/ro31337/bigoposter/blob/master/bigoposter.pdf
  • http://bigocheatsheet.com/

solve

video