3 votes 3 votes Question no 11. DS recursion + – Arnab Bhadra asked Jun 27, 2017 Arnab Bhadra 578 views answer comment Share Follow See all 4 Comments See all 4 4 Comments reply joshi_nitish commented Jun 27, 2017 reply Follow Share fails to make progress?? if N=0 then return 0; here it is '=' (not '==')...which makes 'if' condition 'true' always no matter what is 'N'..and hence it will always return 0.. 0 votes 0 votes Arnab Bhadra commented Jun 28, 2017 reply Follow Share its a pseudo Code 0 votes 0 votes joshi_nitish commented Jun 28, 2017 reply Follow Share then we can neither conclude it as an comparison ... assuming it is an comparison operator...option C is best suited...it is doing redundant work.. R(10) / \ R(5) R(6) / \ / \ R(2) R(3) R(3) R(4) R(3) is called 2 times hence it is doing redundant work.. 0 votes 0 votes Rajucse commented Jul 19, 2018 reply Follow Share Why "if(N=0)" always gives true or 1? 0 votes 0 votes Please log in or register to add a comment.
Best answer 0 votes 0 votes second recursion call never meet the end case (eg:- if N=1 then recurse(1/2+1)=recurse(1) it will never become 0) So it will never return any value. option A no Base case Ankit001 answered Jul 13, 2017 selected Jul 13, 2017 by Arnab Bhadra Ankit001 comment Share Follow See 1 comment See all 1 1 comment reply Harshitkmr commented Jun 3, 2020 reply Follow Share Option B) base case is present ... it is as you said Recurse(1) never becomes 0,,,,therefore fails to make progress. 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes In my opinion option A is correct since it is an assignment operation. If it would have been == then there was no error Abhisek Das answered Jun 27, 2017 Abhisek Das comment Share Follow See 1 comment See all 1 1 comment reply Arnab Bhadra commented Jun 28, 2017 reply Follow Share Its a Pseudo code so how do you say it should be assignment operator 1 votes 1 votes Please log in or register to add a comment.