Class 5
Exam tomorrow
Solving recurrence via master method
For recurrence:
Thus, we could convert it to general form:
if base is "dominant":
eg.
if root is "dominant":
eg.
if neither is "dominant" (balanced: top and bottom work are the same):
eg.
the tree have log n levels and n work per level.
thus, the overall asymptotic complexity = Theta(n log n)
What dominates actually means
f(n) dominates g(n) if f(n) grows polynomial faster than g(n).
eg. n^3 dominates n^2, n^2.000000001 dominates n^2, but n log n does not dominates n.
Essence of master method
Let a>= 1 and b>1 be constants, let f(n) be a function, and let T(n) be defined on the nonnegative integers by the recurrence
where we interpret n/b to mean either ceiling or floor of n/b. Then T(n) has to following asymptotic bounds.
-
Case I: if ( "dominates" ) for some constant c >0, then T(n) = Theta(f(n))
-
Case II: if , ( have no dominate) then %T(n) = Theta(n^{log_b a} log_2 n)%
Extension for
-
if k>-1
-
if k=-1
-
if k<-1
-
-
Case III: if f(n) = Omega(n^{log_b a+c}) **(n^{log_b a-c} "dominates" f(n))**for some constant c >0, and if a f(n/b)<= c f(n) for some constant c <1 then for all sufficiently large n, T(n) = Theta(n^{log_b a+c})