< Free Open Study > |
After studying this chapter, you should be able to
Discuss recursion as another form of repetition
Do the following tasks, given a recursive routine:
Determine whether the routine halts
Determine the base case(s)
Determine the general case(s)
Determine what the routine does
Determine whether the routine is correct and, if it is not, correct it
Do the following tasks, given a simple recursive problem:
Determine the base case(s)
Determine the general case(s)
Design and code the solution as a recursive void or value-returning function
Verify a recursive routine, according to the Three-Question Method
Decide whether a recursive solution is appropriate for a problem
Compare and contrast dynamic storage allocation and static storage allocation in relation to using recursion
Explain how recursion works internally by showing the contents of the runtime stack
Replace a recursive solution with iteration and/or the use of a stack
Explain why recursion may or may not be a good choice to implement the solution of a problem
This chapter introduces the topic of recursion-a unique problem-solving approach supported by many computer languages (C++ included). With recursion, you solve a problem by repeatedly breaking it into smaller versions of the same problem, until you reduce the subproblems to a trivial size that can be easily solved. You then repeatedly combine your solutions to the subproblems until you arrive at a solution to the original problem.
Although recursion may at first appear unwieldy and awkward, when applied properly it represents an extremely powerful and useful problem-solving tool.
< Free Open Study > |
Converted from CHM to HTML with chm2web Pro 2.85 (unicode) |