sir i didn’t understand the meaning of the two conditions clearly in void function.
subsequences(in,out,i+1,j+1);
subsequences(in,out,i+1,j);
Sunsequences doubt in recursion
@rawatsaab4 these 2 conditions are for the 2 cases that are being talked about in the video.
First line refers to the case when we are selecting the character at i’th position in the input string and copying it in output string. This is the reason why we are incrementing both i and j, so that we don’t overwrite j in the next call.
Second line refers to the case when we are not selecting the i’th character in the input string which is why we only incrementing i and not j , so that we overwrite j in the next recursive call.
Dry run the code manually and you’ll see why this recurrence works.
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.