1

how do you find the Theta of this problem... $$T(n) = T(\frac{n}{3}) + \log_2(n)$$ I end up getting a pattern of $$T(\frac{n}{3^{k}}) + \log_2(\frac{n}{3^{k-1}}) + \log_2(\frac{n}{3^{k-2}}) + ... + \log_2(n)$$ when I solve for k with T(1) = 1 I get this... $$\frac{n}{3^{k}} = 1 \\ n = 3^{k} \\ \ln n = k \ln 3 \\ k = \log_3(n)$$ then I plug into the original problem and get this... $$\log_2(\frac{n}{3^{\log_3 n}}) +log_2(\frac{n}{3^{\log_3 n - 1}}) + ... + \log_2(n)$$ I'm not sure how to proceed from this point. Any suggestions?

MD_90
  • 23
  • 1
  • 3

1 Answers1

4

Actually the Master Theorem does not apply in this recurrence.The reason is that $n^{\epsilon}$ is greater than $\log(n)$ for every positive $\epsilon$, making $\log(n)$ ,for a factor $n^{\epsilon}$,polynomially less than $n^{\log_{b}a}=n^0=1$. So we have to work with the replacement method which you have done correctly. Now for $$n=3^k$$ we get $$T(n) = T(1) + \log_{2}(\frac{3^k}{3^{k-1}})+\log_{2}(\frac{3^k}{3^{k-2}})+...+\log_{2}(3^k) $$ which gives us $$T(n) = T(1)+\log_{2}(3)+\log_{2}(3^2)+...+\log_{2}(3^k)$$ which is the same as $$T(n) = T(1)+\log_{2}(3)+2\log_{2}(3)+...+k\log_{2}(3) $$ and now we see that the recurrence can easily be written as $$T(n)=T(1)+\sum_{b=1}^{k}b\log_{2}(3) \Leftrightarrow T(n)=T(1)+\log_{2}(3)\sum_{b=1}^{k}b$$ then we simply solve the summation $$T(n) = T(1) + \log_{2}(3)\frac{k(k+1)}{2}$$ we easily get $$k=\log_{3}n$$ and finally we have $$ T(n) = T(1)+\log_{2}(3)\frac{\log^{2}_{3}n+log_{3}n}{2}$$ And the solution is obviously $$T(n) = \Theta(log^{2}_{3}n)$$ T(n)=T(n/5)+logn is solved accordingly

Sorry for my English!

CharisAlex
  • 76
  • 7