Programming Assignment 1

Linked-Sequence ADT Animation

Data Structures & Algorithms, Spring 2010


Due Date

This assignment is due by 11:30 p.m. on Tuesday, 23 February.

See the assignment turn-in page (last modified on 22 September 2009) for instructions on turning in your assignment.

The absolute deadline for turning-in Assignment 1 is Friday, 26 February at 11:30 p.m.. It is not possible to turn-in Assignment 1 after the absolute deadline.

Background

A linked sequence ADT is a family of data structures representing value sequences. The ADT’s value sequence can contain varying data amounts, and don’t provide direct indexed access to the data in a sequence.

The Problem

Implement one of the three linked-sequence ADTs covered in this section: a linked list, a stack, or a queue. The class should implement the linked sequence interface given in
/export/home/class/cs-305-503/pa1/LinkedSequence.java
The linked-sequence class should include calls to the animation methods described in
/export/home/class/cs-305-503/pa1/LinkedSequenceAnimator.java
Your classes should not implement the LinkedSequenceAnimator interface; they just have to maintain a private instance variable of type LinkedSequenceAnimator to store the instance passed in via the setAnimator() method, and use that variable to call the link() and unlink() methods.

The class should dynamic, capable of storing arbitrarily many values. The class should also be implemented from scratch, without using classes from the Java Collection library.

Implementation

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

$ java -classpath jar-path/pa1.jar:. main [options] class-name

where jar-path is the path to pa1.jar, [options] are optional command-line options, and class-name is the name of the ADT you've implemented. For example, if you implemented a queue and called the class Queue, and you're using pa1.jar in the public class directory, you would type

$ java -classpath /export/home/class/cs-305-503/pa1/pa1.jar:. main Queue

You can simplify your typing a bit by copying pa1.jar to your working directory ( . ):

$ cp /export/home/class/cs-305-503/pa1/pa1.jar .

$ java -classpath ./pa1.jar:. main Queue

If you do copy pa1.jar, make sure you keep it up to date with version in the class directory.

The recognized optional command-line options are:

These command-line options should be given after main and before the ADT class; for example

$ java -classpath pa1.jar:. main -v LinkedList
LinkedList.insertAfter(null, 1) failed.
Can't determine the ADT implemented by LinkedList

$


This page last modified on 17 February 2010.