Sample Assignment: Extending the Linked List Toolkit
|
- The Assignment:
- You
will add some new functions to the linked list toolkit
from Section 5.2 of the textbook.
- Purposes:
- Ensure that you can write ordinary functions to manipulate
linked lists. Note that these are not member functions, because
you are not implementing a class in this assignment.
- Before Starting:
- Read Sections 5.1 - 5.2.
- Complete all three lab exercises.
- Files that you must write:
-
-
newnode.h:
The header file for the new toolkit.
Actually, you don't have to write much of this file.
Just copy our version from
newnode.h
and add your name and other information at the top.
newnode.cxx:
The implementation file for the new
toolkit class. You may start with our implementation from
node.cxx
and add the implementations of the four new functions.
- Other files that you may find helpful:
-
-
newnodetest.cxx:
A simple interactive test program.
The New Linked List Toolkit
Discussion of the Assignment
As indicated above, you will add four new functions to the linked list
toolkit. These new functions are all specified in the header file
newnode.h
.
Hints
- If you learned makefiles last spring, then
spend some time writing your make file
-
A correct make file will save you time. Make sure that
each compilation command in the make file has a TAB
as the first character. In order to insert a TAB using emacs,
type Ctrl-Q and then press the TAB key. Or, if you are working
from a modem where the TAB key is disabled, you can type
ESCAPE x quoted-insert RETURN TAB
Also, make sure that each compilation command includes the
-gstabs option so that you can use the debugger.
- Check Preconditions
-
Your implementations should use the assert function to check
preconditions of all functions.
- Input and Output
-
Your implementations must NOT produce any output to cout, nor
expect any input from cin. All the interaction with the member
functions occurs through their parameters.
Michael Main
(main@colorado.edu)