Outline for February 8
Reading
:
text
, §10
Due
: Homework 3, due on February 15 at 11:55pm
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
More recursion
Palindromes [
palindrome.py
]
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 8, 2019 at 7:40PM