Homework 2
22C:21 Computer Science II: Data Structures
Due Friday, February 8, 2008
1. (6 points) Exercise 2.1, page 50.
2. (12 points) Exercise 2.7, page 51. You should turn in a printout of the code
you used to do parts b and c, but you do not need to submit the code file(s)
to us via the ICON dropbox.
3. (5 points) Exercise 2.25, page 54
4. (10 points) Exercise 2.26, page 54. For this one, you must
submit your code via the ICON dropbox. In the end, the code
for this program is quite short and fairly easy to understand.
However, coming up an algorithm that is efficient and works in
all cases is somewhat tricky. Also, for part c, you might
not be able to carefully argue what the running time is - that's
okay - simply do the best you estimate the running time. In this
case, I suggest doing parts a, b, d, and e, before trying c.
Problem 4 will be difficult for many of you. Don't worry if you
can't fully complete it; though it might take longer than the other
questions, it's not worth a great deal of points.