Computer Science 211
Data Structures

Mount Holyoke College
Fall 2009


Lecture 19: Ordered Structures
Date: Wednesday, October 28, 2009

Agenda

Examples

Lecture Assignment

Due at the start of class, Monday, November 2.

Turn in short answers to these questions. Please turn in a hard copy (typeset or handwritten are OK) at or before the start of class. We will discuss these problems during class, so no late submissions are accepted.

  1. Consider the following three options:
    1. a standard Vector
    2. a MyVector from the sorting lab, which is capable of sorting its contents on demand (by calling the sort method)
    3. an OrderedVector, which might be thought of as a MyVector that automatically sorts during/after each modification to its contents

    Given a set of data which is modified periodically and printed in order periodically, describe briefly the circumstances (relative frequency of modifications and printouts) where each of the above three approaches might be beneficial.

  2. Under what circumstances would a get method as described in Bailey question 11.13 on p. 274 be more useful than the existing contains method? Write a get method for OrderedVector.