O, Ω, Θ
For eventually nonnegative functions, O is an eventual constant-factor upper bound, Ω a lower bound, and Θ both.
REFERENCE SHEET
State the input-size measure and computational model before counting operations.
Before this Proof techniques
For eventually nonnegative functions, O is an eventual constant-factor upper bound, Ω a lower bound, and Θ both.
The size of an encoded input. An integer N written in binary needs Θ(log(N+1)) bits, so polynomial in N need not mean polynomial in input length.
An equation or inequality relating a running time to smaller input sizes, together with base-case costs.
For T(n)=aT(n/b)+f(n), a≥1 and b>1 constants, compare f(n) with nᵖ, p=log_b a. If f=O(nᵖ⁻ε), then T=Θ(nᵖ). If f=Θ(nᵖ), then T=Θ(nᵖ log n). If f=Ω(nᵖ⁺ε) and af(n/b)≤cf(n) for some c<1 eventually, then T=Θ(f(n)). Assume the usual positive constant base costs and nonnegative work.
Repeated halving gives logarithmic recursion depth. A recursion tree must also count the number and cost of nodes at each depth.
Distinguish growth rates before optimizing constant factors.
Analyze mergesort, binary search, and recursive numerical algorithms.
01 / Solve
Each recursion level does total work n.
There are log₂n internal levels, each costing n, and n leaves of cost 1. Thus T(n)=n log₂n+n=Θ(n log n).
02 / Classify
Compare N with the bit length m.
Not in general. For an m-bit positive integer, N can be as large as 2ᵐ−1. The loop can therefore take exponential time in m.
These sheets use this topic as a prerequisite.
Further reading and full-length treatments: