LinkedLists Flashcards
What is the runtime of addFront(x) for an SLList?
O(1)
What is the runtime of removeFront() for an SLList?
O(1)
What is the runtime of addBack(x) for an SLList?
O(1)
What is the runtime of removeBack() for an SLList?
O(n)
What interfaces does an SLList implement?
Stack
Queue
What is the runtime of addFront(x) for a DLList?
O(1)
What is the runtime of removeFront() for a DLList?
O(1)
What is the runtime of addBack(x) for a DLList?
O(1)
What is the runtime of removeBack() for a DLList?
O(1)
What interfaces does a DLList implement?
Deque
List
Stack
Queue
What is the runtime of get(i) for a DLList?
O(1 + min{i, n-i})
What is the runtime of set(i,x) for a DLList?
O(1 + min{i, n-i})
What is the runtime of add(i,x) for a DLList?
O(1 + min{i, n-i})
What is the runtime of remove(i) for a DLList?
O(1 + min{i, n-i})
What is the extra space required by a DLList to store n elements?
O(n)
Each of the n nodes requires two pointers, which take up O(n) space.