Conformation on how the call (storeocc(a,i+1,n,key,out,j) ) is coming in else block

I want to know if the call mentioned will be applied conditionally or every time we drop out of the if block. Also, can it be put in an else statement?

hello @gargprachi1203 could you please elaborate your doubt so that i could help you in the better way .
Happy Learning !!

image
The call mentioned here where j remains unchanged, is it being implemented conditionally? If yes, then can we put it in an else block?

@gargprachi1203 why do you want to put this in else condition because it will be different if it will be in else block.
i would like to mention the difference between both :
the way the code is means that when evrey call which completes in the call stack on returning will execute this second recursion call on returning but in else block it wouldn’t do the same .
i think i have cleared your doubt !
if you still have any please respond here .
Happy Learning !!

So, does that mean that the condition isn’t conditional? Why does the tutor mention else again and again while implementing the call?

@gargprachi1203 listen he meant that if the condition is true then only that recursion call will execute but the second recursion call in which j remains unchanged it will execute everytime .
but if you will put it in else condition then it will only occur when if condition is false .

1 Like

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.