73 votes 73 votes When $n = 2^{2k}$ for some $k \geqslant 0$, the recurrence relation $T(n) = √(2) T(n/2) + √n$, $T(1) = 1$ evaluates to : $√(n) (\log n + 1)$ $√(n) \log n$ $√(n) \log √(n)$ $n \log √n$ Algorithms gateit-2008 algorithms recurrence-relation normal + – Ishrat Jahan asked Oct 28, 2014 • edited Nov 9, 2017 by kenzou Ishrat Jahan 17.3k views answer comment Share Follow See all 5 Comments See all 5 5 Comments reply Show 2 previous comments Higgs commented Oct 28, 2017 reply Follow Share //Assuming you have understood till this ----> √(2k) T(n/(2k))+k√n ---------- (*) When does recursion stop? ---- when base case is reached i.e. T(1) in this case. //given T(1) = 1; So, We have to turn T(n/(2k)) into T(1). How can we do that?? Viewpoint 1: If we put k = lg n, then we get , T(n/(2^lg n)) By this -----> property, we get 2^lg n = n i.e. T(n/n) i.e. T(1). Viewpoint 2: our aim is to substitute 2^k by n in T(n/(2k)). Let's do this substitution first, we get T(n/n) = T(1). Now all we have to do is to find the value of k in terms of n. 2^k = n // take lg => k = lg n Thus, substituting value of k in (*) we get: √(2log2n) + log2n √n 3 votes 3 votes kirtikanwar commented Dec 9, 2017 reply Follow Share Then what's the use of condition n=2^2k mention in question? 0 votes 0 votes Joyoshish Saha commented Jul 21, 2020 reply Follow Share Can it be solved using recursion tree method? Does the method work for a problem where the subproblem division is non-integral(like here sqrt(2))? 1 votes 1 votes Please log in or register to add a comment.
2 votes 2 votes As T(1) =1 , Checking if options are giving 1 at n=1: A) giving 1 B),C),D) giving 0. To be on safer side lets check for n=2: T(2)=2 √2 (by putting n=2 in given recurrence) by checking options we will find that only A) is giving 2 √2 Punit Sharma answered Oct 27, 2018 Punit Sharma comment Share Follow See all 0 reply Please log in or register to add a comment.
1 votes 1 votes One long yet detailed way of doing this is using substitutions for matching parts: akashmaji945 answered Sep 21, 2023 akashmaji945 comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes using masters theorem we get a =√2 b =2 n ^( log b a)= n^ ( log 2 √2 ) = n ^(1/2 log 2 2) = n 1/2 =√n f(n) = √n So second rule of masters theorem applies T(n) =θ(√n log n) sh!va answered Jul 17, 2016 • edited Jul 17, 2016 by sh!va sh!va comment Share Follow See all 2 Comments See all 2 2 Comments reply cse23 commented Jul 17, 2016 reply Follow Share a/c to master theoram: it should be θ(√n) 0 votes 0 votes sh!va commented Jul 17, 2016 reply Follow Share Could you please explain steps to get θ(√n)? 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes Answer is A npx answered Jun 27, 2021 npx comment Share Follow See all 0 reply Please log in or register to add a comment.