X381: addNodeAtHead

Consider the following class definition:
   class Link{
      Object data;
      Link next;
   }
Create a new node with info 'A' and insert it at the beginning of the list headed by p. Given that the list L contains the elements ['B', 'C'] and p points to B and q points to null.

Initial Setup Final Configuration

Your Answer:

Reset
Visualize

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.