Cs141 Home/Hwk1

Cs141 Home | Cs141 Home | recent changes | Preferences

Homework 1, due Thursday, Jan 20 at the beginning of class.

If you can't attend class, slide it under my office door before 11am.

1. Problem R-3.6 (from the text). Do the top two rows of functions only.

2. Problem R-3.8, except do only two columns: 1 hour (column 2) and 2 hours (not in the table).

3. R-3.13

4. C-3.8 The input is a sequence a1, a2, ..., an. The output is a sequence A1, A2, ..., An where Ai = a1 + a2 + ... + ai. Explain why your algorithm is correct (this should be easy). Explain what the running time is, and why. Try to find an O(n)-time algorithm.

5. C-3.14 and/or C-3.15. (hint for 3.14: Try to do O(n) work to reduce the problem to size n/2. Then recurse. If you can do this, the total running time will be proportional to n + n/2 + n/4 + ... + 1 = O(n).) (hint for 3.15: have each taster sample more than one bottle. you want to be able to uniquely identify the bottle by seeing which set of tasters dies.)


Cs141 Home | Cs141 Home | recent changes | Preferences
This page is read-only | View other revisions
Last edited January 13, 2005 11:23 pm by Neal (diff)
Search: