Suppose the DblListnode<E> class is implemented as in the readings.
The following class implements the ListADT interface using a circular doubly-linked chain of nodes:
public class CircularDblLinkedList<E> implements ListADT<E> {
// Reference to the first node (position 0) of a circular doubly-linked
// chain of nodes. Recall that the next reference of the last node
// references the first node and the prev reference of the first node
// references the last node making the chain of nodes circular.
private DblListnode<E> items;
// The number of items in the list
private int numItems;
public CircularDblLinkedList() {
// Initially the list is empty
items = null;
numItems = 0;
}
// Return the item at position pos if pos is valid, otherwise throw
// IndexOutOfBoundsException. This method traverses the fewest nodes
// possible while locating the node at pos.
public E get(int pos) {
// IMPLEMENT THIS
}
}
Complete the get() method according to its specification. For full credit, your solution:
Assume you are comparing three different algorithms to solve some problem and have determined the worst-case time equations for each:
public static void secret(String secretString) { int n = secretString.length(); StackADT<Character> stack = new ArrayStack<Character>(); for (int i = 0; i < n; i++) { stack.push(secretString.charAt(i)); } while(!stack.isEmpty()) { Character ch = stack.pop(); System.out.print(ch); } }Briefly describe what secret(...) method does.