|CSC 161||Grinnell College||Spring, 2010|
|Imperative Problem Solving and Data Structures|
This laboratory provides you with more experience using lists and pointers.
The previous lab filled in two parts of the program ~walker/c/lists/namelist.c In this lab, you are to fill in two more menu options.
Note: Do NOT go on to the next part until you have written a convincing answer to this question!
To perform this task, you first have to read in the name of the item desired. Then you need to search the list item-by-item to find the desired item. Next you need to remove that given item from its current place in the list (if it is not already first). Finally you need to insert that given item at the beginning of the list.
Since manipulation of lists is most efficient if only pointers are manipulated, your program should neither create new nodes nor dispose of existing ones. In particular, your program should not use either the malloc or free functions during the processing of putFirst.
Also, your program should respond appropriately in all cases. In particular, putFirst should print appropriate messages if either list is null or the item designated is not found on the list.
This document is available on the World Wide Web as
created 27 September 2001
last revised 4 April 2010
|For more information, please contact Henry M. Walker at firstname.lastname@example.org.|