
CS 220 – Programming with Data Structures – Fall 2009
Homework #2
(not being collected, for exam review)
1. Suppose that you want to store nobjects in a list. Compare the space requirements
to do this using the array based implementation AList (from text) versus the linked
implementation LList. Write an expression for the total amount of space required,
using rto represent the space required by each reference, and dto represent the space
required by each data object.
2. Name three factors that you would consider in deciding between using an array-based
or linked list representation for an application. Explain why each factor is important
for the decision and which implementation method it suggests.
(Note: you must be specific enough about factors so that the factor suggests a par-
ticular implementation, your factors cannot be general like: “consider frequent list
operations.”)
3. Text Chapter 8, Exercise No. 1.
4. Text Chapter 8, Exercise No. 2.
5. Text Chapter 8, Exercise No. 9.
Do this both recognizing that the Java ArrayList class implements the Iterable inter-
face, and pretending that it does not.
6. Text Chapter 8, Exercise No. 16.
7. Text Chapter 9, Exercise No. 3.
8. Text Chapter 9, Exercise No. 6a.
9. Text Chapter 9, Exercise No. 10.
10. Text Chapter 9, Exercise No. 24.