1
$\begingroup$

I solved the question T(n) = T(sqrt(n)) + 1 but can't quit understand one step of the solutionenter image description here

I don't understand the transition in (1). how did we conclude that T(m) = T(m/2) + 1 from the previous step that m is in the power?

$\endgroup$

1 Answer 1

1
$\begingroup$

It obviously is not correct. To fix it, define $S(m)=T(2^m)$, and then we would have $S(m)=S(m/2)+1$. Now, continue with the proof replacing everywhere $T(m)$ with $S(m)$. After you solve what $S(m)$ is, substitute $m=\log(n)$ in the solution to get what $T(n)=T(2^m)=S(m)$ is.

$\endgroup$
1
  • $\begingroup$ Thanks' a lot. got the answer. didn't pay attention to the substitution of the function as well. $\endgroup$ Apr 15, 2021 at 12:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.