Announcement
ACM Officer elections for 2006-2007 will be held later today.
Meet outside of room EPS 363 at 4:00 p.m. if you are interested.
How to Limit a LinkedList to Queue Functionality
An Example of Recursion in Music
Recursive Definitions of Mathematical Formulas
- Factorial
- Fibonacci
- x^n
- Greatest Common Divisor
gcd (m, n) = n if n is a divisor of m
gcd (m, n) = gcd(n, m % n) otherwise
Lecture Code
Recursion Pitfalls
Advantages of Recursion
- Often, the code is easier to write
- Often, the code is easier to understand
- Recursion is a more powerful problem solving technique than iteration
Advantages of Iteration
- There is no method call overhead
- Sometimes, the natural iterative solution has a better
time complexity than the natural recursive solution