Take out a piece of paper. We’ll be programming on paper.
public class DLinkedList<E> implements List211<E> { /** Holds the head of the list. */ private DLinkedNode<E> head; /** The size of the list. */ private int size; // Your steps go here. /** Doubly linked node. */ private class DLinkedNode<E> { E data; DLinkedNode<E> next; DLinkedNode<E> prev; } }
Answer the following questions:
What is the Big-O of the add(E item) method? Why?
What is the Big-O of the remove(int index) method? Why?