X630: deleteNode

Consider the following class definition:
   class Link{
      Object data;
      Link next;
   }
List L has a reference to the first node. Write code that given a value returns reference to the first node of List L without the given value. Make sure to account for edge cases!

Initial Setup Final Configuration

Examples:

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

Your Answer:

Reset
Visualize

Feedback

Your feedback will appear here when you check your answer.