4.5 The master method for solving recurrences

4.5-1

a

Here, we have a = 2, b = 4, and f(n)=Θ(1), and thus we have that nlogba=nlog42=n12. Since n12 is polynomially larger than f(n) (that is, f(n)=O(n12ϵ) for ϵ12), case 1 applies, and T(n)=Θ(n12).

b

Here, we have a = 2, b = 4, and f(n)=Θ(n), and thus we have that nlogba=nlog42=n12. Case 2 applies, so T(n)=Θ(nlgn).

c

Here, we have a = 2, b = 4, and f(n)=Θ(n), and thus we have that nlogba=nlog42=n12. Since f(n)=Ω(n12+ϵ), for ϵ12. Case 3 applies if we can show that the regularity condition holds for f(n). For sufficiently large n, we have that af(nb)=2f(n4)=2n4=n2cf(n) for c=23. So T(n)=Θ(n).

d

Here, we have a = 2, b = 4, and f(n)=Θ(n2), and thus we have that nlogba=nlog42=n12. Since f(n)=Ω(n12+ϵ), for ϵ32. Case 3 applies if we can show that the regularity condition holds for f(n). For sufficiently large n, we have that af(nb)=2f(n4)=2n4=n2cf(n) for c=12. So T(n)=Θ(n2).

4.5-2

In Strassen's algorithm, T(n)=Θ(nlg7). In Professor Caesar's algorithm, T(n)=aT(n4)+Θ(n2). In order to beat Strassen's algorithm, then Professor Caesar's algorithm cannot apply case 3, since f(n)=Θ(n2) which is polynomially larger than Θ(nlg7).

We have that nlogba=nlog4a=nlga2. If case 2 applies, then f(n)=Θ(nlga2), so nlga2=n2, a = 16. And T(n)=Θ(nlga2lgn)=Θ(n2lgn) which cannot beat Strassen's algorithm.

So case 1 applies. And T(n)=Θ(nlga2), and we have lga2<lg7, thus a<49, so the largest integer value of a is 48.

4.5-3

Here, we have a = 1, b = 2, and f(n)=Θ(1), and thus we have that nlogba=nlog21=1. Case 2 applies, so T(n)=Θ(nlogbalgn)=Θ(lgn).

4.5-4

Here, we have a = 4, b = 2, and f(n)=Θ(n2lgn), and thus we have that nlogba=nlog24=n2. Since f(n) is not polymonially larger than n2, so we cannot use master method to solve the recurrence.

According to exercise 4.6-2, f(n)=Θ(n2lgn)=Θ(nlogbalgkn), where k = 1. So T(n)=Θ(nlogbalgk+1n)=Θ(n2lg2n)=Θ((nlgn)2).

4.5-5