Hello. I'm not very familiar with recursive programming, and my problem here is that the recursive statements dont seem to be returning properly to an upper layer. While writing out the process on paper I feel this code should be correct, but it isn't working properly. The below method is initially called by an array list with a count equal to its size.
The return looks similar to:
public static void powerSets(ArrayList<Integer> array, int count)
ArrayList<Integer> temp = array;
if (count == 0)
for (int i = 0; i <= temp.size(); i++)
where it removes the first item each time (i = 0) but it never seems to step up properly and advance i to 1. The next lines are intended to be:
[x, y, z]
What am I doing wrong that is keeping recursion from bumping up a layer and incrementing the for loop properly?