Recursion subsequences:showing runtime error

https://ide.codingblocks.com/s/72999

@sjduttabbsr2017 hey sindu
I am suggesting to use this one
void printsubseq(string q, string ans) {

	if (q.length() == 0) {
		cout<<ans<<" ";
		return;
	}

	char ch = q[0];
	string ros = q.substr(1);

	printsubseq(ros, ans);

	printsubseq(ros, ans + ch);

}

and for count make similar function with return type int
count both the call
and base case when q.length()==0
return 1

hey neeraj,
can you please tell me what was wrong in my code.

@sjduttabbsr2017 hey Sindhu sorry for the late reply in your code there was basically two errors the first thing is you forget to give the return and second error is that the recursive call you made subsequences(inp,out,i+1,j);
subsequences(inp,out,i+1,j+1);
but it is like
subsequences(inp,out,i+1,j+1);
subsequences(inp,out,i+1,j);
after all this thing done your problem output will not match with the the sample output so that why I suggest you my approach if you have any approach comes in your mind feel free to share we will work on it

i have comment ur mistake

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.