Блог пользователя gXa

Автор gXa, история, 9 лет назад, По-английски

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 )

  • Проголосовать: нравится
  • -7
  • Проголосовать: не нравится

»
9 лет назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

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