Programming Assignment 4

Classifying Sorts

Data Structures and Algorithms, Spring 2011


Due Date

This assignment is due by 11:30 p.m. on Wednesday, 6 May.

See the assignment turn-in page (last modified on 2010 February 23) for instructions on turning in your assignment.

The absolute deadline for turning-in Assignment 4 is Saturday, 9 May at 11:30 p.m. It is not possible to turn-in Assignment 4 after the absolute deadline.

The Problem

Write the method analyze() that accepts a sort s and determines the type of array — sorted or unsorted — on which s sorts the quickest.

analyze() is defined in the interface

/export/home/class/cs-503/pa4/SortClassifier.java

The Sorter interface used in SortClassifier does not need an implementation. The classes implementing the Sorter interface are part of the jar file.

Implementing

Once you’ve got your implementation far enough along, you can try it out using the jar file
/export/home/class/cs-503/pa4/pa4.jar
by typing

$ java -classpath jar-path/pa4.jar:. main class-name

where jar-path is the path to pa4.jar and class-name is the name of the class implementing the SortClassifier interface. For example, if the class ClassifySort implements SortClassifier and you’re using pa4.jar in the public class directory, you would type

$ java -classpath /export/home/class/cs-503/pa4/pa4.jar:. main ClassifySort


This page last modified on 2011 April 18.