-3
$\begingroup$

My solution: let m = lg n. Then n = 2^m. T(2^m) = T(2^(m/2)) + theta(lgm). Let S(m) = T(2^m). Then S(m) = S(m/2) + theta(lgm). Applying master theorem, I get m^(lg1) = 1 which is asymptotically smaller than theta(lgm). So I think case 3 of the master theorem should apply. However, the solution given explains that case 2 of the master theorem applies here which I do not quite understand.

$\endgroup$
1
  • $\begingroup$ Hello and welcome to cs.SE! Please edit your question so that it is complete, readable, and detail your own attempts at solving the problem. $\endgroup$ Aug 8, 2020 at 6:46

2 Answers 2

2
$\begingroup$

Let $S(n) = T(2^n)$. Write a recurrence formula for S, solve S(n), use that to solve T(n).

$\endgroup$
1
$\begingroup$

T(n) = T(√n) + ϴ(log log n) …….1
Let n = 2m
Taking log2 both side, we get
log2n = m ……2
=> (log n) /log 2 = m (using the formula logab = logmb /logma)
=> log n = m x log2
Now, equation 1 becomes
T(2m) = T(2(m/2)) + ϴ(log (m x log2))
=> T(2m) = T(2(m/2)) + ϴ(log (m) + loglog2))
As we know that constant can be ignored hence loglog2 can be ignored
=> T(2m) = T(2(m/2)) + ϴ(log m) …….3
Now, let T(2m) = S(m) ……4
then T(2(m/2)) = S(m/2)
So eq. 2 becomes:
S(m) = S(m/2) + ϴ(log m)
Now it is in master’s form, i.e T(n) = aT(n/b) + ϴ(nk x logp n)
here a = 1, b= 2, k = 0 , p = 1
which follows the case a = bk, where p > -1
Hence S(m) = ϴ(mlogba x log(p+1) m)
=> S(m) = ϴ(mlog21 x log2 m)
=> S(m) = ϴ(m0 x log2 m)
=> S(m) = ϴ(log2 m)
Substituting S(m) with T(2m) from eq. 4
T(2m) = ϴ(log2 m)
Now substituting the value of m from equation 2, we get
T(n) = ϴ(log2 log2n)
Thus it doesn't matter what base is log the answer will be same taking log both side instead of log2 will make our job more easier.

$\endgroup$

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.