Lecture 7 Objectives
At the end of today's class you should
KNOW:
- What a recursive function is
- The three criteria to use to show that a recursive function is correct
- When to use recursion, and when not to
- That algorithms with exponential running times are impractical for all but very-small-sized problems
BE ABLE TO:
- Write a recursive C function
- Show that a recursive function is correct
Sample Exam Question:
Write a recursive C function that satisfies the following pre- and
post-conditions:
PRE: base is an int, and exponent is an int >= 1
POST: the function returns base raised to the exponent power