Outline for February 4, 2019


  1. Recursion
    1. n factorial cnfact.py]
  2. 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
  3. Recursion
    1. Palindromes [palindrome.py]
    2. Fibonacci numbers [rfib.py]
    3. Sum of digits [sumdigits.py]
    4. Greatest common divisor [gcd.py]
    5. Nested lists: is an item in a list? [isinlist.py]
    6. Tower of Hanoi [hanoi.py]
  4. isinstance(obj,type) function
    1. type is bool, float, int, list, str, tuple

Matt Bishop
Department of Computer Science
University of California at Davis
Davis, CA 95616-8562 USA
Last modified: Version of January 30, 2019 at 8:10PM
Winter Quarter 2019
You can get a PDF version of this