For the following class, create the methods:
void smallestFirst() method that moves the node with thesmallest integer in the list to become the first node.
copy constructor and clone() methods. Both must create a deepcopy of the list.
private class Node
{
int value;
Node next;
/**
Constructor.
@param val The element to store in the node.
@param n The reference to the successor node.
*/
Node(int val, Node n)
{
value = val;
next = n;
}
/**
Constructor.
@param val The element to store in the node.
*/
Node(int val)
{
// Call the other (sister) constructor.
this(val, null);
}
}
private Node first; // list head
public String reverseToString(){
String result = “”;
Node temp = first;
while(temp != null) {
result = temp.value + result;
temp = temp.next;
}
return result;
}
public
PayPal Gateway not configured
PayPal Gateway not configured