Sir, how can i add the recursive function for count the number of subsequences

hello @chandreshmaurya

u can pass one count variable by reference in ur function.
and whenever u hit the base case increment that count variable by 1.

check this->

sir, my output is coming in reverse order.

sir, if i do like this … generate_subsequences(in,out,i+1,j,count); generate_subsequences(in,out,i+1,j+1,count); , Then, there is no any output. why ?

…

because u have included the character at posiiton j .
and just after that u have made call on generate_subsequences(in,out,i+1,j,count);
this call will put new character at position j , so ur previous value will get discarded, that why u r not getting any output.

check now->

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.