X409: addNodeAtTail

Consider the following class definition:

 public class Link{
    Object data;
    Link next;
 }

Create a new node with info 'D' and insert it at the end of the list headed by p. Given that the list L contains the elements ['A','B','C'] and p points to 'A'.

Here is the initial set up:

and here is the expected final configuration

Your Answer:

Reset
Visualize

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.