Subset Sum Easy

how to solve this question using recursion

hi @vivekpatel

let SubsetSumEasy(int arr[], int i,int out[],int j) be the function to find whether there is a subset with sum equal to 0 and n is the number of elements in arr[].

The SubsetSumEasy problem can be divided into two subproblems
…a) Include the element, recur for j = j+1,
…b) Exclude the element, recur for j = j,
If any of the above the above subproblems return true, then return true.

Recursive Case
SubsetSumEasy(arr, i, out,j) = SubsetSumEasy(arr, i+1, out, j+1) OR
SubsetSumEasy(arr, i+1,out,j)
Base Cases: if sum of all elements of out ==0 && j>0 return true;

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.