Question: Supplied Code public class DoubleNode { private double data; private DoubleNode link; public DoubleNode(double data, DoubleNode link) { this.data = data; this.link = link; }

 Supplied Code public class DoubleNode { private double data; private DoubleNode

Supplied Code

public class DoubleNode {

private double data;

private DoubleNode link;

public DoubleNode(double data, DoubleNode link) {

this.data = data;

this.link = link;

}

public double getData() {return data;}

public DoubleNode getLink() {return link;}

public void setData(double data) {this.data = data;}

public void setLink(DoubleNode link) {this.link = link;}

} // close DoubleNode

public class DoubleLinkedList {

private DoubleNode top;

public void addToStart(double data) {

DoubleNode newNode = new DoubleNode (data, top);

top = newNode;

}

} // close DoubleLinkedList

Complete the following instance method for the DoubleLinkedList class above. The method should move the DoubleNode at the position passed as a parameter to the end of the list. For example moveToEnd(2) should move the 3rd DoubleNode in the list to the end of the list. If there is no such DoubleNode, the method should do nothing. public void moveToEnd(int pos) {

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!