gXa's blog

By gXa, history, 8 years ago, In English

Can someone please help me to solve this using recursion tree method, I am trying it but unable to solve it. T(N) = sqrt( N ) T( sqrt( N ) ) + sqrt( N )

  • Vote: I like it
  • -7
  • Vote: I do not like it

»
8 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

On each level of recursion tree the total work is n^(1-1/2^(i+1)) -on the 0 level you have n^(1/2) -on the 1 level you have n^(1/2) calls with work sqrt(n^(1/2)) = n^(1/2+1/4) -on the 2 level you have n^(1/2) call from 0->1 and n^(1/4) from 1->2, each with work n^(1/8) = n^(1/2+1/4+1/8) and so on...

Depth of the recursion tree is log long n So the total work is sum_{i=0}^{log log n} n^(1-1/2^(i+1)) which is O(n log log n). The exact value is https://www.wolframalpha.com/input/?i=sum+from+0+to+%28log+log+n%29+n%5E%281-%281%2F2%29%5E%28i%2B1%29%29