Arithmetic with big-O [00L0]

The following properties hold for \Omega and \Theta as well.

  • k O(f) = O(f) when k is a constant, i.e. does not depend on n
  • O(f) + O(g) = O(\max (f,g)) (running algorithms in sequence)
  • O(f) O(g) = O(fg) (running nested algorithms)

For example, O(3n^2 + 17n + 8) = O(3n^2) + O(17n) + O(8) = O(n^2) + O(n) + O(1) = O(n^2).