Outline for February 22

Due: Homework 4, due on March 4 at 11:55pm

  1. Binary search
    1. Ordered list only: how it works
    2. Example [search-3c.py]
    3. Recursive [binsearch.py]:
      1. Base case: high < low, return failure; word is list[mid], return mid
      2. Recursive part: if word < list[mid], search word[low..mid-1]; if word > list[mid], search word[mid+1..high]
  2. Putting a program together: Rock, Paper, Scissors
    1. Goal and general algorithm idea
    2. Data representation and program structure
    3. Figure out who wins [rps-prog1.py]
    4. Get computer choice [rps-prog2.py]
    5. Get user input [rps-prog3.py]
  3. Putting a program together: Cæsar cipher
    1. Problem statement
    2. Design and refinement
    3. Implementation [caesarenc.py, caesardec.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 23, 2019 at 2:08PM