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
  • 276,994
  • 27
  • 311
  • 503
Meli497
  • 11
  • 2
  • Check this link for the logarithm doubt. It's valid for any base. – Gokul Dec 06 '18 at 14:02
  • 2
    What is $d$ supposed to mean in "Also he declared $d$ as 2 [...]"? – dkaeae Dec 06 '18 at 14:07
  • 1
    It might be that in the context of computer science, absent a specific base for the logarithm, it's assumed to be 2. I've seen some people adopt this convention. – Rick Decker Dec 06 '18 at 14:30
  • @dkaeae sorry, d is in terms of the Master Theorem the variable for the exponent of the asymptotical function f(n). So basically the last part of the function. So basically for square root(x) d would be 1/2 since square root(x) = x^(1/2) – Meli497 Dec 06 '18 at 15:41
  • @RickDecker Gokul: I see, I will google if I find more confirmation to this, but that would make sense. Do you have any idea how the exponent of the last part (=d) is assumed to be 2? Because I would assume that it would be 1/2 since x is in a square root. – Meli497 Dec 06 '18 at 15:46
  • 1
    @Meli497 Could you add your version of the master theorem's statement to the question? I believe the source of your confusion is in mistaking $d$ for something different. – dkaeae Dec 06 '18 at 16:21
  • 1
    @Meli497 No, really, what is "d"? Just giving an example doesn't help. You seem to be implicitly assuming that everybody writes down the master theorem using exactly the same notation and that just isn't true. – David Richerby Dec 06 '18 at 17:42

0 Answers0