Outline for February 8

Reading: text, §10
Due: Homework 3, due on February 15 at 11:55pm


  1. Thinking recursively [recfun.py]
    1. First: think of the recursive case (write the problem in terms of something involving a smaller instance of the problem)
    2. Next: think of base case (when to stop)
    3. Example: Find the length of a string
    4. Example: Does the string only have alphabetic characters in it?
    5. Example: Find the maximum element of a list
    6. Example: Construct a string from a list of strings
    7. Example: Reverse a string
  2. More recursion
    1. Palindromes [palindrome.py]


UC Davis seal
Matt Bishop
Office: 2209 Watershed Science
Phone: +1 (530) 752-8060
Email: mabishop@ucdavis.edu
You can also obtain a PDF version of this.
Version of February 8, 2019 at 7:40PM