CS 112
Hw 9
Due Wednesday April 17, by midnight
Before starting working on this homework, and for
practicind the
ideas discussed in class on Thursday, look at an old
exam. Do problems 3, 5 and 6 from the
exam. Be ready
to ask me questions on Tuesday. This will help you understand
the material and the assignment.
Part I. Implementing a complete List Class
- Finish the
implementation of the list abstract data type in C++. Similar to Hw8
but it should also have a destructor and be implemented as a template.
The
class should be called List.
You will have to design a class
that closely implements the structure illustrated by the
list applet.
- Apply the software design and testing methodology that I have emphasized
throughout the semester:
- Start the design of the class on paper.
- Create the header file for the class, but implement only one
function at a time and test it thoroughly before moving on to the
next one.
- The testdriver should include options to allocate a new list dynamically,
on which you will test functions such as insert and delete. The
interaction with the user should be menu-driven. The menu
options should mirror the buttons of the list applet, with
options for creating and destroying a list, inserting and deleting
elements, printing and navigating through the list.
- Submit in Hw9I.
Part II. A new Stack class implemented with linked lists
- Implement a Stack using linked lists. I.e. finish what we started in the lab on Thursday.
- Incorporate the new Stack into the old ArithExp arithmetic-expression class you did for
Homework 6. Compile and run it on the same examples that were required for Hw 6.
- Submit in Hw9II.
Part III: List implementation of a Queue
Implement a Queue abstract data type using a linked list (instead
of an array).
To submit
Submit in Hw9I, Hw9II and Hw9III all the files that are necessary for
compiling, executing and proving the correctness of your code:
header and implementation files, testdriver, makefile and a
typescript, plus a data file with your test data.
Ileana Streinu