1

I have trouble understanding how to apply the master theorem in the following problem:

$$T_2(1) = 1; T_2(n) = 4T_2(2^{\log \lfloor \frac{n}{2}\rfloor}) + \sqrt{n} \text{ for } n > 1.$$

My professor first rewrote this problem as

$$ T_2(n) = 4T_2(\lfloor \tfrac{n}{2} \rfloor) + \sqrt{n} \text{ for } n > 1, $$

which I don't quite understand. As far as I'm concerned you can only rewrite the log formula that way if the logarithm has a base of 2. So basically like that:

$$ a^{\log_a x} = x. $$

Also he declared $d$ as 2, even though if it's a square root, $d$ should be 1/2. Can someone clear me up how he got to the following solution? I'm really confused since I thought I understood the theorem fairly well. The final result should be $$ T_2(n) \in \Theta(n^2). $$


I finally understood my mistake: $d$ is indeed 1/2, and therefore smaller than $\log_b a$ (=2). The 3rd case of the master theorem therefore applies.

Yuval Filmus
  • 280,205
  • 27
  • 317
  • 514
Meli497
  • 11
  • 2

0 Answers0