COSC 235: Programming and Problem Solving
May 4, 2009

Joseph D. Sloan
sloanjd @ wofford.edu


Program Due Tuesday

Finally, don't forget to check your code for documentation, appropriate use of subroutines, etc.

Recursion

A function that calls itself is recursive.
Expressive but a danger of infinite loops.

Three Laws of Recursion:
1. Must have non-recursive base-case
2. Must test for base-case before recursive call
3. Recursive call must be "simpler", i.e., must "move toward" the base-case

examples

 


This page was created by Joe Sloan.
It was last modified on or after: 6 May2009
Send mail to: sloanjd@wofford.edu