Page 405 - AP Computer Science A, 7th edition
P. 405
CHAPTER 7
Recursion
recursion n. See recursion. —Eric S. Raymond, The New Hacker’s Dictionary (1991)
Chapter G oals
• Understanding recursion
• Recursive methods
• Recursion in two-dimensional grids • Recursive helper methods
• Analysis of recursive algorithms
• Tracing recursive algorithms
In the multiple-choice section of the AP exam, you will be asked to understand and trace recursive methods. You will not, however, be asked to come up with code for recursive methods in the free-response part of the exam.
RECURSIVE METHODS
A recursive method is a method that calls itself. For example, here
is a program that calls a recursive method stackWords.
public class WordPlay {