quartz/content/out/notes/big-o.md
2022-04-06 20:11:37 +12:00

688 B
Raw Blame History

title draft sr-due sr-interval sr-ease
Big-O true 2022-06-01 62 271

tags: #review


Big-O

Big O means f(n) = O(g(n)) if there is some constant A > 0 such that for all sufficiently large n, f(n) ≤ A × g(n).

  • Big O provides upper bounds only. (usually on worst case runtimes)
    • sometimes cost will be much less
      • does not take special cases into account
      • upper bound
  • O says that g(n) provides an upper bound for f(n)
    • "Insertion sort is $O(n^2)$" -> the maximum number of basic operations in never more than some constanct times n^2
  • if f(n) =O(g(n)) then the opposite is also true
  • usually f(n) is complex but g(n) is very simple