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