2. Master Theorem
The solution to the equation
T(n) = aT(n/b) + θ(nk
), where a >= 1 and b >1 is
Ө(nlog
b
a
) if a > bk
T(n) = Ө(nk
logn) if a = bk
Ө(nk
) if a < bk
3. Example
Solve the following recurrence using Master Theorem
T(n) = 8T(n/2) + O(n2
)
a = 8, b = 2, k = 2
⇒a > bk
, 8 > 22
)()()( 38lg2
nOnOnT ==⇒
4. Matrix Multiplication
procedure stmul(n,A,B,C)
if n>=1
partition A into A11,A12,A21,A22
partition B into B11,B12,B21,B22
c=AxB
stmul(n/2,A11,B11,m1)
stmul(n/2,A12,B21,m2)
stmul(n/2,A11,B12,m3)
stmul(n/2,A12,B22,m4)
stmul(n/2,A21,B11,m5)
stmul(n/2,A22,B21,m6)
stmul(n/2,A21,B12,m7)
stmul(n/2,A22,B22,m8)