Question: Remove all occurrences of item from the list in Java... *You may not add any fields to the node or list classes. * You may
Remove all occurrences of item from the list in Java...
*You may not add any fields to the node or list classes.
* You may not add any methods to the node class.
// Example list: "11 21 5 5 31 41" expects this list "[ 11 21 31 41 ]" when double item = 5.
public class MyLinked2 {
static class Node {
public Node (double item, Node next) { this.item = item; this.next = next; }
public double item;
public Node next;
}
int N;
Node first;
public void remove (double item) {
// TODO
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
