X640: removeRefNext9
Consider the following class definition:
class Link{
Object data;
Link next;
}
p is a reference to the first node in a List L. Integer val is the value of a node in L. You would remove the next node (after the node containing val) if there was one. Make sure to account for edge cases! If the value exists multiple times, assume the value is of the first instance. If the int parameter is null or doesn't exist then don't change the list.
Initial Setup | Final Configuration |
Examples:
removeRefNext(Link.CreateList(1,2,3,4),2) -> Link.CreateList(1,2,4)
Your Answer:
Feedback
Your feedback will appear here when you check your answer.