572 views
0 votes
0 votes
int CALL(int K)

{

if(K<3)

return 1;

else CALL(K-1) + CALL(K-3) +1;

}

value returned by CALL(CALL(5))is.............

1 Answer

0 votes
0 votes
We can see repeating subproblems. Don't prefer tree method for this question as the tree will be very big to analyse.This will be easy
 call (0) = call (1) = call (2) = 1

call (3) = call (2) + call (0) + 1 = 3

similarly call (4) = 5. Follow and solve answer will be 17

Related questions

0 votes
0 votes
1 answer
1
0 votes
0 votes
1 answer
2
tishhaagrawal asked Dec 16, 2023
357 views
Below is my approach to solving this question, can anyone please explain if I am doing it the right way?Let X = #free slotssince, m =7 and n = 3So, $4 \leqslant x\leqsla...
0 votes
0 votes
0 answers
3
Dadu asked Dec 7, 2023
214 views
Please solve I am unable to understand the solution given by made easy