2009 AP CS A Exam Multiple Choice #39 Solution 2

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

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

Stack based trace of 2009 AP CS A Multiple Choice #39

2009 AP CS A Multiple Choice #39 (as PDF)

2 thoughts on “2009 AP CS A Exam Multiple Choice #39 Solution

  1. Reply afra Apr 21,2013 3:58 pm

    what i can write a program in c or c++ languages that facilitates the trace of recursive program?

    • Reply Brandon Horn Apr 22,2013 1:25 pm

      You don’t need to write a program to trace a recursive method. The debugger in any IDE will show you the method calls in a stack.

Leave a Reply