Lab 10 -- Linked Lists Variations

Answer Sheet

Exercise 1

Assume the data field in the list above is a float number. Write a struct declaration, called Node for a node in this list. Use "prev" (for previous) and "next" as the names of the pointer fields. Call the data field "data".


Exercise 2

Redraw the picture of the doubly linked list after inserting a node containing 46.92 into the list after the node pointed to by p. Draw the picture on your final printed answer sheet












Exercise 3

Write the code segment to remove the node pointed to by p. Don't forget to free the space occupied by the node and don't forget to test if p is the first node in the list. Leave the data from the deleted node in the variable saveData.


Exercise 4

Assuming that it has been determined that we need to manipulate a linked list in such a fashion that there is no ending node or no beginning node, explain why you think that a circular linked list should be used. HINT: Will it eliminate unnecessary processor activities? If so, describe these activities.

Exercise 5

Assume that p is pointing to a node that should be inserted at the beginning of the list. Show code to insert the node pointed to by the pointer, p, into the beginning of the list. Don't forget that head is a dummy header and should never be changed.


Exercise 6

Redraw the picture after: Able, 99200 is inserted. Draw the picture on your final printed answer sheet









Exercise 7

{ Script }

----- End of Lab 10 - Linked Lists Variations-----
Complete the Exercises on the Answer Sheet.
Turn in the Answer Sheet and the printouts required by the exercises.