Question: 10. (12 points) Consider a singly-linked list containing the following animals (in this order): cow, dog, duck, cat, and canary. (a) Draw a picture of
10. (12 points) Consider a singly-linked list containing the following animals (in this order): cow, dog, duck, cat, and canary.
-
(a) Draw a picture of the linked list. Be sure to include a reference to beginning of the list called head.
-
(b) Suppose that a reference called prev points to the node containing dog. Show how to remove the node containing duck. Draw a picture and give the pseudocode.
-
(c) Suppose that a reference called prev points to the node containing cat. Show how to insert a node containing moose between cat and canary. Draw a picture and give the pseudocode.
-
(d) What is a header node? Defend the existence or absence of such a node in the linked list you have drawn above.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
