Recursion 1
From Huben's Wiki
(Created page with "Recursion is one of the major tools of computing. (Iteration is another, and the next.) '''Recursion''' means a method calls itself as part of solving a problem. If all a meth...") |
|||
Line 8: | Line 8: | ||
* Do Handout 1: Sierpinski's Triangle | * Do Handout 1: Sierpinski's Triangle | ||
+ | |||
+ | Count M&M's 2 ways exercise. | ||
Recursive methods generally have 4 parts (though some are often vestigial or combined): | Recursive methods generally have 4 parts (though some are often vestigial or combined): | ||
Line 17: | Line 19: | ||
* How do these parts apply to the Sierpinski's Triangle exercise? | * How do these parts apply to the Sierpinski's Triangle exercise? | ||
+ | * How do these parts apply to the count M&M's exercise? | ||
+ | |||
+ | Handout 2: Describing Recursive methods | ||
+ | |||
+ | * Do the first 3. | ||
+ | * Mark these 4 things on the handout. | ||
+ | # Draw an arrow to the test that determines whether recursion stops or continues. | ||
+ | # Write how the problem is divided into smaller parts. | ||
+ | # Underline the recursive call. | ||
+ | # Draw arrows to where the results are combined and returned. |