Computer Science 15-112, Fall 2011
Class Notes: Practice (through week 5)
- Previous practice handouts
See this handout and
this handout for
previous practice problems, including many problems that use strings in
interesting ways.
- Practice Problems in list notes
In this week's
list notes, be sure to carefully study the Locker Problem, Anagrams,
the Sieve of Eratosthenes, and the Prime Counting Function.
- Mastermind Redux
Also check out this
additional Mastermind practice problem from S11 recitation 4. Try to
implement the missing functions before consulting the sample solutions
provided.
- findDuplicates, Caesar Cipher, Vigenere
Cipher
Also in
that same recitation, check out the findDuplicates problem, along
with a sample solution. Then check out
S11 recitation 5, which includes both a Caesear Cipher (look
familiar?) and a Vigenere Cipher, along with sample solutions.
- Tracing and Mystery Methods
Try the tracing and mystery methods from
F10 recitation 7.
- Quizzes
Check out
S11 quiz4 (ignore 2d lists) and
F10 quiz5 (ditto).
- Rewrite list methods
As with strings, one of the easiest ways to practice writing functions with
lists
is to rewrite the list methods only using simple built-in functions, like len, and operators like +,
+=, and
slicing. For example, try these:
- index
- count
- min
- max
- sum
- copy
- sorted
- sort
- reverse
- Math over lists of numbers
- Standard set operations: intersection, union,
difference, ...
- Standard vector operations: vectorSum,
dotProduct, ....
- Standard statistics: mean, geometricMean,
median, stdDev, ...
carpe diem -
carpe diem - carpe diem - carpe diem
- carpe diem - carpe diem -
carpe diem - carpe diem - carpe
diem