This problem can be easily solved using a stack. My explanation of Tracing recursive methods explains the technique.

Also see my complete 2004 AP CS A Multiple Choice solutions.

## Stack based trace of 2004 AP CS A Multiple Choice #26

2004 AP CS A Multiple Choice #26 Solution (as PDF)