6

According to Introduction to algorithms by Cormen et al, $$T(n)=2T(n/2)+n\log n$$ is not case 3 of Master Theorem. Can someone explain me why?

And which case of master theorem is it?

FrankW
  • 6,609
  • 4
  • 27
  • 42
user16715
  • 61
  • 1
  • 1
  • 3

2 Answers2

4

$\log n$ grows slower than $n^\epsilon$ for any $\epsilon>0$. Thus $n\log n$ grows slower than $n^c$ for any $c>1$. However, the third case of the Master theorem requires the existance of a $c>1$ so that $n\log n$ grows at least as fast as $n^c$ (up to a constant factor).

The function is covered by the second case of the Master theorem as given in Wikipedia.

FrankW
  • 6,609
  • 4
  • 27
  • 42
3

Case 3 of Master Theorem:

If $f(n)=\Omega(n^{\log_b a+\epsilon})$ for some constant $\epsilon > 0$, and if $f (n/b) ≤ cf (n)$ for some constant $c < 1$ and all sufficiently large $n$, then $T (n) = \Theta(f (n))$.

Here $f(n)=n\log n$ and $n^{\log_ba}=n^{\log_2 2}=n^1=n$. So $n^{log_ba+\epsilon}=n^{1+\varepsilon}$. But $n\log n$ is not $\Omega(n^{1+\epsilon})$.

So it is not under case 3. It is also not under second case: If $f(n)=\Theta(n^{\log_ba})$, then second case can be applied. But here $n^{\log_ba}=n$ and $f(n)=n\log n$ is not $\Theta(n)$.

This recurrence can't be solved by Master method.

David Richerby
  • 82,470
  • 26
  • 145
  • 239
Tanmoy Banerjee
  • 956
  • 2
  • 12
  • 24