retagged by
671 views

2 Answers

Best answer
4 votes
4 votes
$\color{olive}{T(n) = 2T(\sqrt{n}) + log(n)}$

Let $\color{navy}{n = 2^m}$, and putting this in above recurrence relation.

$T(2^m) = 2T(2^{\frac{m}{2}}) + m$

Let, $S(m) = T(2^m)$, then, $S(\frac{m}{2}) = T(2^\frac{m}{2})$

$S(m) = 2S(\frac{m}{2}) + m$

This is similar to Merge-Sort (or) using master's theorem, it can be said that $S(m) = O(mlog_{2}(m))$

Now. replacing $m$ by $log_{2}(n)$, $\color{red}{T(n) = O(log_{2}(n)log_{2}log_{2}(n))}$
selected by
3 votes
3 votes
$\color{red}{T(\sqrt{n})}$ always gives us $\log \log n $ level in the recursion tree and in this particular question each level has equal work which is $\log n$.

Total work = net complexity = $\log n . \log \log n$ = $O(\log n . \log \log n)$
edited by

Related questions

2 votes
2 votes
2 answers
1
0 votes
0 votes
1 answer
2
Amoljadhav asked Mar 1
128 views
how many spanning trees are possible for complete graph of 4 vertices
0 votes
0 votes
0 answers
3