Computer Science 211
Data Structures

Mount Holyoke College
Fall 2009

Lab 3: Comparators are my Favorite Sort of Vectors
Due: 9:00 AM, Friday, October 9, 2009

In this week's lab, you will extend the functionality of an existing class using inheritance, you will implement a simple sorting procedure within this extension, and you will learn about Comparators, which provide a more flexible mechanism for ordering objects than the Comparables we have seen in class.

The lab is described at the end of Chapter 6 in Bailey.

Before Lab

Read Section 6.8 in the text to learn about Comparators. Come to our meeting with a brief description of the sort method that you will write, and ideas for some interesting data to use for the testing of your implementation.

Lab Programming Assignment

Do the laboratory at the end of Chapter 6.

Please note the following clarifications, modifications, and explanations relating to the lab procedure outlined in the text:

Thought Questions

Answer the thought questions at the end of the lab. Include your responses in the README file described below.

Submitting Your Work

When you're finished, create a tar file lab3.tar that includes the following:

Submit lab3.tar by emailing it to jteresco AT as an attachment.


This lab assignment is graded out of 30 points. As in all labs, your grade includes design, documentation, style, and correctness. Be sure to document your program with appropriate comments (use Javadoc!), including your name and a general description at the top of the file, a description of each method with pre and postconditions where appropriate. Also use comments and descriptive variable names to clarify sections of the code which may not be clear to someone trying to understand it.

Grading Breakdown

Pre-lab design 2 points
Program design 2 points
Program style 3 points
Program documentation 5 points
Program correctness: MyVector 5 points
Program correctness: Comparators 5 points
Program correctness: sorting applications 2 points
"Interestingness" of sorting applications 2 points
Thought questions 4 points

The program design grade will be based on the design choices you make in the implementation of all of the classes you will submit. The program style grade will be based on code formatting and approriate use of Java naming conventions. The program documentation grade is, of course, based on the comments you provide (including Javadoc and pre and postconditions as appropriate). The program correctness grades are based on how well the different parts of your program meet the functionality requirements.