Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Java public class DoubleNode { private double data; private DoubleNode link; public DoubleNode (double data, DoubleNode link) { this.data = data; this.link - link; }
Java
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 newlode = new DoubleNode (data, top); top = newNode; } } // close Doublelinked List Complete the following instance method for the Double LinkedList 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started