X363: concatenateTwoLists

Consider the following class definition:
   class Link{
      Object data;
      Link next;
   }
Link p has a reference to the first node of List L. Link q is a reference to the first node of List L'. Return 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)
Reset
Visualize

Practice a different Java exercise