can you please help get a hint as I am unable to convert my thoughts in code
I ma unable to figure out this question
take two variables size and sum
set intially both to zero
now process elements using recursion
// base case:
if(sum==0&&size>0) return true;
if(i==n)return false;
case 1: consider the element into subset
return rec(arr,i+1,sum+arr[i],size+1);
case 2: doesn’t consider the element
return rec (arr,i+1,sum,size)
this is basic structure of recursive function
i hope this helps
sir i am first trying to print the subsets of number and my code is not running can you please check
if(inp[i]==’\0’){
out[j]=’\0’;
cout<<out<<" ";
return;}
this is used for character array
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.