Solve T(n) = 9T(n/6) + n log2 n, by master method. (10 marks) try case 2
Solution
To solve the recurrence relation T(n)=9T(6n)+nlog2n using the Master Method, we follow these steps:
Step 1: Identify Parameters for Master Method
The recurrence is in the form:
T(n)=aT(bn)+f(n)
Here, a=9 (number of subproblems),
b=6 (factor by which the problem size is reduced),
f(n)=nlog2n (the non-recursive part).
Step 2: Calculate nlogba
We need to find nlogba where:
logba=log69=log6log9
Using the change of base formula with log69:
log69=log6log9=log(2×3)log(32)=log2+log32log3
Approximating log3≈0.4771 and log2≈0.3010:
log69≈0.3010+0.47712×0.4771=0.77810.9542≈1.226
Thus, nlog69=n1.226.
Step 3: Compare f(n) with nlogba
f(n)=nlog2n
nlogba=n1.226
To apply the Master Theorem, we compare f(n) with nlogba:
f(n)=O(n1.226−ϵ) for some ϵ>0 — Case 1
f(n)=Θ(n1.226) — Case 2
f(n)=Ω(n1.226+ϵ) and af(bn)≤cf(n) for some c<1 and sufficiently large n — Case 3
Applying Case 2
f(n)=nlog2n grows slower than n1.226, but they are not polynomially related because the log2n factor grows slower than any polynomial in n.
However, for Case 2, f(n)=Θ(nlogbalogkn) is often a form considered when k=0, and here k=1. So, we need to re-check our basis, comparing against n1.226.
Reassessing Case 2 with Specific Functions
Since nlog2n=Θ(n1.226), f(n) is not precisely Θ(n1.226), suggesting we use a comparison:
f(n)=nlog2n is indeed Ω(n1.226−ϵ) for small ϵ, indicating it is not quite a Case