Rules for Big O
There are several rules that make it easy to find the order of a
- Any constant multipliers are dropped.
- The order of a sum is the maximum of the orders of its summands.
- A higher power of n beats a lower power of n.
- n beats log(n) (by a lot).
- log(n) beats 1 (just barely).
- 2n beats any power of n.
For example, in analyzing T(n) = 2 * n2 + 5 * n + 100,
we first drop all the constant multipliers to get n2 + n + 1
and then drop the lower-order terms to get O(n2).