X363: concatenateTwoLists

Consider the following class definition:
   class Link{
      Object data;
      Link next;
   }
p is a reference to the first node of List L. Link q is a reference to the first node of List L'. Return a refernce to a the first node of the concatenated list. Make sure to account for edge cases!

Initial Setup Final Configuration

Examples:

concatenateTwoLists(Link.CreateList(1,2,3),Link.CreateList(4,5,6)) -> Link.CreateList(1,2,3,4,5,6)

Your Answer:

Reset
Visualize

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.