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.
public static void powerSets(ArrayList<Integer> array, int count)
ArrayList<Integer> temp = array;
if (count == 0)
for (int i = 0; i <= temp.size(); i++)
The return looks similar to:
[x, y, z]
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:
What am I doing wrong that is keeping recursion from bumping up a layer and incrementing the for loop properly?