# GATE | Gate IT 2008 | Question 42

• Difficulty Level : Easy
• Last Updated : 22 Apr, 2020

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

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

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.

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

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)
```

Alternate Solution :

This question can be easily done by substitution method look:
T(1)= 1; GIVEN.
Now use n=2 in the given recurrence relation which gives 2*(1.414) (since value of root over 2 is 1.414)
now by looking at the options use n=2 which satisfies option A.

My Personal Notes arrow_drop_up