# GATE | Gate IT 2008 | Question 42

When n = 22k for some k ≥ 0, the recurrence relation

T(n) = √(2) T(n/2) + √n, T(1) = 1

evaluates to :
(A) √(n) (log n + 1)
(B) √(n) (log n )
(C) √(n) log √(n)
(D) n log √(n)

Answer: (A)

Explanation: Please note that the question is asking about exact solution. Master theorem provides results in the form of asymptotic notations. So we can’t apply Master theorem here. We can solve this recurrence using simple expansion or recurrence tree method.

```T(n) = √(2) T(n/2) + √n
= √(2) [√(2) T(n/4) + √(n/2) ] + √n
= 2 T(n/4) + √2 √(n/2) +√n
= 2[ √2 T(n/8) + √(n/4) ]+√2 √(n/2)+√n
= √(2^3) T(n/8)+ 2 √(n/4) + √2 √(n/2) +√n
= √(2^3) T(n/8)+√n +√n +√n
= √(2^3) T(n/(2^3))+3√n
.............................................
= √(2^k) T(n/(2^k))+k√n
= √(2^logn) + logn √n
= √n + logn √n
= √n(logn +1)
```

My Personal Notes arrow_drop_up

Article Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.