MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / subset

Method subset

Java/Recursion/Subset_Sum.java:4–9  ·  view source on GitHub ↗
(int arr[],int s, int i, int n)

Source from the content-addressed store, hash-verified

2class Subset_Sum
3{
4 static int subset(int arr[],int s, int i, int n)
5 {
6 if(i == n)
7 return ((s == 0) ? 1 : 0);
8 return subset(arr, s - arr[i], i+1, n) + subset(arr, s ,i+1, n);
9 }
10 public static void main(String args[])
11 {
12 Scanner I = new Scanner(System.in);

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected