Previous: Asymptotic function comparison, Up: Asymptotics
Geometric sum:
The sum 1 + α + α2 + … + αn =
(αn+1 - 1)/(α - 1), if α ≠ 1.
As a function of n, this geometric sum has leading term
The three cases may also be expressed simply as &Theta(1), &Theta(n), and Θ(αn), respectively.
Master Theorem [upper bound form]:
Given the recurrence T(n) ≤ aT(n/b) + cnd, for some constant c,
let e = logb(a).
Then
Paraphrase: The exponent of n is whichever dominates: the non recursive work (nd) or the total work at the deepest lever of recursion, alogb(n). But when these two are equal there is a log(n) factor.
Proof idea: Consider the work at each depth of recursive call and get a formula of the form nd ∑logb(n) (a/bd)i.
Master Theorem [lower bound form]:
Given the recurrence T(n) ≥ aT(n/b) + cnd, for some constant c,
let e = logb(a).
Then
Master Theorem [codominant form]:
Given the recurrence T(n) = aT(n/b) + Θ(nd), for some constant c,
let e = logb(a).
Then
In the codominant case, we may also say, T(n) is essentially nmax(d, logb(a)). The "essentially" simply means that we are ignoring logarithmic factors.
The master theorem applies to divide and conquer algorithms. Some algorithms lead to recurrences of the form T(n) = aT(n-b) + Θ(nd). These might be called "subtract and conquer" or "giant step, baby step" algorithms. There is a similar theorem addressing these in this attachment (which also has a restatement of the master theorem). master theorem