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.

  1. (a) Draw a picture of the linked list. Be sure to include a reference to beginning of the list called head.

  2. (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.

  3. (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.

  4. (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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!