+1 vote
How do we use MT to solve T(n) = 2T(n/2) + n^2 log n?

c = 2 > log_b(a) here, but f(n) = Theta (n^2 log n) instead of purely Theta(n^2).

Besides, for T(n) = 2T(n/2) + n logn, f(n) / n^log_b(a) = log n, there is a non-polynomial difference right? Then why can we use MT for it?
in Asymptotic Analysis by AlgoMeister (768 points)
edited by

2 Answers

+2 votes
 
Best answer

The provided recurrence is of the form T (n) = a T(n/b) + theta (nk logpn) where a>=1, b >1, k >=0, p is a real number. The value of a=2, b=2, and k=2, and this means that a < bk

Since the value of p  >= 0, then T (n) = Theta (nk log p n)

After applying the master theorem, the time complexity for the provided recurrence would be:

T(n) = Theta (n^2 log n) 

by AlgoMeister (920 points)
selected by
Thank you Amal. Could you please tell me which case of MT are we referring to?
Hello, it is case 3.
Hi, are you suggesting T(n) = Ө(f(n)) if f(n) = Ω(n^c) where c > log_b(a)? This might be a little different from case 3 on the textbook.
Yes, the case 3 in the book states: "If f(n) is too large, then f(n) term dominates".
+1 vote

The answer is: T(n) = Θ(n2log n).

a = 2, b = 2, logba = 1, f(n) = n2log n.

f(n) = n2log n = Ω(nc), if c = 2, yes, c > logba = 1, so it is case 3. Then T(n) = Θ(f(n)) Θ(n2log n).

If f(n) is too large, then f(n) term dominates.

Sometime we can just asymptotically compare f(n) with nlogba to find out which term dominates.

by AlgoStar (440 points)
The Book: Analysis and Design of Algorithms | Presentations on Slideshare | Lecture Notes, etc
...