edited by
841 views

1 Answer

Best answer
4 votes
4 votes

(b) $6$

You can achieve the maximum depth of 6 recursive calls when you have following elements on the stack :

$0,1,2,3,4,6$

($6$ being the element on the top and $0$ being the element at the bottom.)

Once you reach this state, you have to start popping the elements from the stack.

You can find a similar, but better question here.

selected by

Related questions

2 votes
2 votes
0 answers
2
2 votes
2 votes
0 answers
3