This website is preserved for historical and scholarly reference and is no longer actively maintained.
                         CpSc 210, Section 1
                             Assignment 7 
                             March 8, 2001


Due:  Thursday, March 14 at 11:59 p.m.  

Assignment:  Extend Bailey's Singly Linked List to include a tail reference


Total point value of assignment:  100 points
Not accepted late.

This assignment is to be done INDIVIDUALLY.

Assignment:  Design and implement a class, ListWithTail as an extension of
     Bailey's SinglyLinkedList, which must be stored in a file named
     ListWithTail.java.  (20 point deduction for failure to name file 
     correctly!)  

The List interface is given on pages 99-100 of Java Structures.  Your
program should include every method in the order in which the methods
are listed in the interface.  If the method in SinglyLinkedList can be
used without any changes, your code listing should include the method
as a comment:

     // public Iterator elements();  is supplied by the super class

Since we have not covered the elements() method, you should assume
that this method is supplied by the super class.  (Also, your
test driver does not need to test the elements() method.)

If you with to call the method in the super class as part of your code, 
you can do this "super." as a prefix.  For example, if my code needs
to execute addToHead for the super class, it would be coded:

     public void addToHead ( Object value )
     // post:  adds value to the beginning of list
     {
        super.addToHead ( value );
        if ( null == tail )     // the list was initially empty
           tail = head;
      }


You should make use of the code supplied by the super class whenever
doing so does not adversely affect the efficiency of your code. 
A method will be marked incorrect if the efficiency is not best possible.

An outline for the class is

     import structure.SinglyLinkedList;
     import structure.SinglyLinkedListElement;

     public class ListWithTail extends SinglyLinkedList
     {
        protected SinglyLinkedListElement tail;   // could be private

        public ListWithTail ( )
        {
           super ( );   // calls constructor of SinglyLinkedList class
           tail = null;
        }

        // and more methods

     }

Grading Rubric:

	10 pts. reasonable attempt to solve problem as assigned
	10 pts. also compiles
	10 pts. style standards (includes clarity)

    The following 70 points are available only for code that compiles 
    without error.   Some considerations are:

	code works correctly
	growth rates of methods in ListWithTail are best possible (big-oh)
	when appropriate, methods of superclass are called rather than code copied
	quality of your test driver
	elegance of code
    comments are used to show methods not changed


Other requirements: The first operation of your main program must be to print "CPSC 210", your name, the assignment number, and a brief description of the assignment.

Follow the style standards to be found on your instructor's web page for CPSC 210. Submit your program using the handin command. There is a link to the handin description on the CPSC 210 lab page (www.cs.clemson.edu/~lab210).