recursiveSum(Node currentNode) {
if (currentNode == null){
System.out.println("done " );
}else{ recursiveSum(currentNode.next);
}
}
Heres the node class and the recursive method. I have tried everything that I can possibly think of to return all possible subsets... if i add the numbers {`1,2,3} to the list, the recursive method should print: {1,2,3} {1,3} {1,2} {1} {1,3} {2} {3} {0}
private static class Node {
Node next;
int number;
public Node(int numberValue) {
next = null;
number = numberValue;
}
public int getNumber() {
return number;
}
public void setData(int numberValue) {
number = numberValue;
}
public Node getNext() {
return next;
}
public void setNext(Node nextValue) {
next = nextValue;
}
}