CS 2005, B Term 1999
Data Structures and Programming Techniques
HW3 (due Nov. 19)
This page is located at http://www.cs.wpi.edu/~alvarez/CS2005/B99/HW3/
The objective of this assignment is to implement the List ADT
using linked lists as described in section 5.4 of Main and Savitch.
Your implementation should use the linked list tools discussed in class;
also see section 5.2 of Main and Savitch.
Section 5.3 describes a linked list implementation of
the Bag ADT which you may find to be helpful.
Examine the class definition for the List class that appears in the
header file list3.h, available in
/cs/cs2005/samples/hw3/list3.h. Do not make any changes in the header file.
Note that the header file list3.h being provided for HW3 includes
specific choices of the private member variables of the List class
together with specific conventions regarding their meanings
(see the comments in section 5.4 of the textbook).
In particular, the implementation in HW3 uses linked lists.
Refer to section 3.2 of the textbook for a discussion of the List ADT,
as well as a different implementation of it using static arrays.
In a separate file called list3.cxx, implement the functions
whose specifications appear in list3.h. All function preconditions
given in the specification must be asserted in the corresponding
You must use linked lists to store the items of List objects,
using the private member variables defined in list3.h.
The linked list toolkit described in section 5.2 of Main and Savitch
is being made available to you for this purpose in the directory
/cs/cs2005/samples/hw3/. The relevant files are named link1.h and link1.cxx.
In this regard you may find it helpful to carefully review chapter 5
of Main and Savitch,
and in particular to study the linked list implementation of the Bag class
presented in section 5.3.
A simple test program listtest.cxx for the List class is available
in /cs/cs2005/samples/hw3/listtest.cxx. Link listtest.cxx
to your List class implementation and to the linked list
toolkit using the Makefile provided in /cs/cs2005/samples/hw3/Makefile.
Perform multiple sample runs to debug your implementation.
Note that your submitted HW3 files must compile and link
correctly under g++ on the CCC Unix machines when the Makefile
in /cs/cs2005/samples/hw3/Makefile is used.
The source code for your implementation in list3.cxx
should be carefully commented. Provide additional documentation
for your code in a file named README, following the WPI CS
documentation standard. You do not need to include the actual
source code in the documentation file, just the names of the
appropriate source files. Include screen views of several
sample runs of your program. Your README file should also
include a brief discussion of the merits and drawbacks of
the linked list implementation of the List class.
Can you suggest an improved implementation? Justify your claims.
Use turnin to submit the following files (and no other files),
fully addressing the items listed above, before 5 pm on Friday
Nov. 19, 1999.