**Reading**: *text*, §9

- Greetings and felicitations!
- Homework 3 is out – 20 extra points if in by Wednesday, 10 if by Friday; due Monday, November 9
- Extra Credit 1 due tonight
- Extra Credit 2 is out and due November 9

- Recursion
- Expressing a problem in terms of a simpler version of itself — use
*n*! and searching a character string - Function calling itself
- Similar to mathematical induction, but backwards
- Structure: base case, recursive case
- What happens if you omit the base case? (Bad things …)

- Expressing a problem in terms of a simpler version of itself — use
- How it works
- Program stack
- Walk through
*nfact*, with*n*= 4 - Note
*nfact*calls*nfact*

- The argument list
- Go through how
*main*in*nfact.c*gets integer

- Go through how
- Recursive greatest common divisor
- Go through Euclidean algorithm for computing gcd
- Walk through function
*gcd*, with*m*= 4 and*n*= 6 - Do it again with
*m*= 14 and*n*= 35 - Go through program
*gcd.c*

You can also obtain a PDF version of this. | Version of November 3, 2015 at 12:22AM |