In: Computer Science
I need an example of how to swap and index within a doubly linked list with index + 1. This is written in java.
public class A3DoubleLL<E> {
/*
* Grading:
* Swapped nodes without modifying values - 2pt
* Works for all special cases - 1pt
*/
public void swap(int index) {
//swap the nodes at index and
index+1
//change the next/prev connections,
do not modify the values
//do not use
delete/remove/insert/add to help with this process
//make sure to account for all
special cases
}
private Node start, end;
private int count;
public A3DoubleLL() {
start = end = null;
count = 0;