When i tried to find the time complexity of this recurrence relation with the master theorem, I got log^2n, but I'm told that it's logn. I used the masters theorem, for this case.. a=b^k (1=4^0) ... This means that this is a case 2 in the masters theorem. Then p in this case is 1 since log^1n. So the answer for case 2 where p>-1 would be n^k log^p+1n = theta(log^2n). But the solution on my exam said the answer is theta(logn). Can you help me understand.
Asked
Active
Viewed 64 times
0
-
You can use $L^AT_EX$ (MathJAX) here. Effective line breaks in markdown: append two blanks to preceding line. – greybeard Jun 03 '23 at 17:41
-
You applied the masters theorem correctly for $T(n) = T(n/4) + \log(n)$ it implies $T \in \theta(\log(n)^2)$, given ofc. that $T(n) = \theta(1)$ below some bound $n < \kappa$. Make sure that you read the task properly, maybe you missed something. – plshelp Jun 03 '23 at 17:43
-
https://cs.stackexchange.com/q/2789/755 – D.W. Jun 03 '23 at 20:53
-
@Yor $T(n)=\Theta(\log^2 n)$ is correct but $T(n)=\Theta(\log n)$ is wrong. Assuming $\log$ means $\log_2$, the function $T(n)=\frac{\log n(\log n+2)}4$ satisfies the recurrent relation. Have you checked with the grader of the exam again? – John L. Jun 08 '23 at 12:46