level: Recursion
Questions and Answers List
level questions: Recursion
Question | Answer |
---|---|
Define recursion | Definition: Recursion occurs when a function calls itself. |
Decribe a gerneral way to impliment any recursive problem | Am I at the base case? If so, return the easy solution if a function and stop recursing; or if a procedure stop recursing. Otherwise, think in terms of solving the current problem by moving closer to the base case with a slightly simpler problem and solving this simpler problem. |
Define a Recursively-defined function/procedure | A recursively-defined function/procedure is a function/procedure which calls itself or which is defined in terms of itself. |
Define a recursive object | An object is said to be recursive if it partially consists of or is defined in terms of itself. |
Impliment a recursive formula for generating positive integers between 1 and 5 | begin with x to the 1 = 5 x to the n+1 = x to the n – 1 stop when x to the n+1 = 1 |