Impossible to solve
n (1/2 k ) = 1
for k, since if n> 1, then n x > 1 for any nonzero x. The only way you could solve this is to choose 1/2 k = 0, but that is not possible.
However, you can solve the following:
n (1/2 k ) = 2
First, take the magazine on both sides:
(1/2 k ) log n = log 2 = 1
Then multiply both sides by 2 k :
log n = 2 k
Finally, take the log again:
lg lg n = k
Therefore, this recurrence will stop as soon as k = log lg n.
Although you were only asking for the value of k, since a full year has passed since you asked, I thought I wanted to indicate that you can do a variable change to solve this problem. Try setting k = 2 n . Then k = log n, so your recurrence
T (k) = 2T (k / 2) + k
This solves (using the main theorem) the value T (k) = & Theta; (k log k) and using the fact that k = log n, general recursion is solved in & Theta; (log n log log n).
Hope this helps!
source share