Outline for February 4
Reading
:
text
, §10
Due
: Homework 2, due on February 4 at 11:55pm
— note extension
List example [
addup.py
]
Thinking recursively [
recfun.py
]
First: think of the recursive case (write the problem in terms of something involving a smaller instance of the problem)
Next: think of base case (when to stop)
Example: Find the length of a string
Example: Does the string only have alphabetic characters in it?
Example: Find the maximum element of a list
Example: Construct a string from a list of strings
Example: Reverse a string
Matt Bishop
Office: 2209 Watershed Science
Phone: +1 (530) 752-8060
Email:
[email protected]
You can also obtain a PDF version of this.
Version of February 1, 2019 at 8:09PM