For each of the methods associated with each data structure, classify it based on its runtime, using Big O notation.
-
What is the runtime complexity of
addToTail?a. What if our list implementation didn't have a reference to the tail of the list in its constructor? What would be the runtime of the
addToTailmethod? -
What is the runtime complexity of
removeHead? -
What is the runtime complexity of
contains? -
What is the runtime complexity of
getMax?
-
What is the runtime complexity of
enqueue? -
What is the runtime complexity of
dequeue? -
What is the runtime complexity of
isEmpty? -
What is the runtime complexity of
length?
-
What is the runtime complexity of
insert? -
What is the runtime complexity of
contains? -
What is the runtime complexity of
getMax?
-
What is the runtime complexity of
bubbleUp? -
What is the runtime complexity of
siftDown? -
What is the runtime complexity of
insert? -
What is the runtime complexity of
delete? -
What is the runtime complexity of
getMax?
-
What is the runtime complexity of
ListNode.insertAfter? -
What is the runtime complexity of
ListNode.insertBefore? -
What is the runtime complexity of
ListNode.delete? -
What is the runtime complexity of
DoublyLinkedList.addToHead? -
What is the runtime complexity of
DoublyLinkedList.removeFromHead? -
What is the runtime complexity of
DoublyLinkedList.addToTail? -
What is the runtime complexity of
DoublyLinkedList.removeFromTail? -
What is the runtime complexity of
DoublyLinkedList.moveToFront? -
What is the runtime complexity of
DoublyLinkedList.moveToBack? -
What is the runtime complexity of
DoublyLinkedList.delete?a. Compare the runtime of the doubly linked list's
deletemethod with the worst-case runtime of theArray.splicemethod. Which method generally performs better?