did not understand the process at time stamp 6.50
Did not understand the process at time stamp 6.50
see
what is happening is
like in sequential functions we go through each line
but here we call the same function from within the function it goes on calling hitself until the base case is hit
here also f(3) calls f(2) calls f(1) now since base condition if( n == 0 || n == 1 ) is hit it return back some value
then the next line f(n-2) is called when n = 2 here again f(0) is called [hits base condition]
then the stack trace returns
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.