- Back in goAgain("today", 1)
- Finished the recursive call, got back "odayay"
- Computes "today" + "odayay", which is"todayodayay"
- Stops and returns "todayodayay"
Resulting call stack
g("ay", 3)  returns "ay"
g("oday", 2)     "oday" + "ay"  returns "odayay"
g("today", 1)    "today" + "odayay"  returns "todayodayay"
Navigation
Back to Step 5
Back to main solution
Back to 2009 AP CS A MC explanations