X362: changeHeadNodeValue

Consider the following class definition:
   class Link{
      Object data;
      Link next;
List L has a reference to the first node. Given a reference to a node in a list, make that node the new head and wrap the list around (given A B C D E F, with a reference to E the list becomes E F A B C D). Make sure to account for edge cases!

Initial Setup Final Configuration


changeHead(Link.CreateList(1,2,3,4),3) -> Link.CreateList(3,4,1,2)

Practice a different Java exercise