Lab Exercise #4
for lab meeting Wednesday, Sept. 28, 2005
In this lab you will implement a few common operations on linear lists.
The book's LinearNode class
provides some basic methods on individual linear nodes. The book also
includes LinkedIterator, which provides the usual iterator
methods. Your task here is to develop and test a class LinearList,
which imports LinearNode and LinkedIterator, and
has the following characteristics:
a LinearList object has three private data fields:
count: a count of the number of nodes in the list;
front: a pointer to the first node in the
list;
rear: a pointer to the last node in the list
these methods are provided:
constructor
toString
addToFront: given a pointer to a node, add this node
to the front of the list
addToRear: given a pointer to a node, add this node to
the rear of the list
removeFront: remove the first node
removeRear: remove the last node
This is easiest to do incrementally. First implement the constructor, toString,
and addToFront methods, and test these. Then add more methods
one or more at a time.