Programming Assignment 1

Linked-List Animation

Data Structures and Algorithms, Spring 2011


Due Date

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

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

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

Background

A linked sequence is a family of data structures representing value sequences. A value sequence can contain varying data amounts, and dont provide direct indexed access to the values in a sequence.

The Problem

Implement a linked sequence as a linked list. The class should implement the linked-sequence interface given in
/export/home/class/cs-503/pa1/LinkedSequence.java
The linked-sequence class should include calls to the animation methods described in
/export/home/class/cs-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 be dynamic; instances should be 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-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 an option giving the name of the linked-list class. For example, if you're using pa1.jar in the public class directory, you would type

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

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

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

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

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 between main and the class name if given, or at the end of the command line if the class name isn't given. For example:

$ java -classpath pa1.jar:. main -v 
Using the LinkedList implementation of the LinkedSequence interface.

$ java -classpath pa1.jar:. main -v LList
Using the LList implementation of the LinkedSequence interface.

$


This page last modified on 2011 February 2.