Add a method to the Linked List classes we created in class(posted below).
Make sure your method only changes the pointers to the other nodesand not the actual data being stored.
Make sure to account for all special cases.
Method Header:
public void swap(int index)
If the index = 0, then swap 0 and 1, if 10 is given, swap 10 and11.
Double linked
public class MyDoubleLinkedList<E> {
private Node start, end;
private int currentCount;
public MyDoubleLinkedList()
{
start = null;
end = null;
currentCount = 0;
}
public void printList()
{
Node current = start;
while(current != null)
{
System.out.println(current.value);
current = current.next;
}
}
public void printListRev()
{
Node current = end;
while(current != null)
{
System.out.println(current.value);
current = current.prev;
}
}
public void add(E val)//O(1)
{
Node newItem = new Node(val);
//if list is
PayPal Gateway not configured
PayPal Gateway not configured