Answer the following questions for each of the data structures you implemented as part of this project.
- What is the runtime complexity of
enqueue?
O(1)
- What is the runtime complexity of
dequeue?
O(1)
- What is the runtime complexity of
len?
O(1)
- What is the runtime complexity of
insert?O(log n) - What is the runtime complexity of
contains?O(log n) - What is the runtime complexity of
get_max?O(log n)
-
What is the runtime complexity of
_bubble_up? -
What is the runtime complexity of
_sift_down? -
What is the runtime complexity of
insert? -
What is the runtime complexity of
delete? -
What is the runtime complexity of
get_max?
- What is the runtime complexity of
ListNode.insert_after?
O(1)
- What is the runtime complexity of
ListNode.insert_before?
O(1)
- What is the runtime complexity of
ListNode.delete?
O(1)
- What is the runtime complexity of
DoublyLinkedList.add_to_head?
O(1)
- What is the runtime complexity of
DoublyLinkedList.remove_from_head?
O(1)
- What is the runtime complexity of
DoublyLinkedList.add_to_tail?
O(1)
- What is the runtime complexity of
DoublyLinkedList.remove_from_tail?
O(1)
- What is the runtime complexity of
DoublyLinkedList.move_to_front?
O(1)
- What is the runtime complexity of
DoublyLinkedList.move_to_end?
O(1)
- What is the runtime complexity of
DoublyLinkedList.delete?
O(1)a. Compare the runtime of the doubly linked list'sdeletemethod with the worst-case runtime of the JSArray.splicemethod. Which method generally performs better?DoublyLinkedList.deletewill run better (atO(1)) than theArray.splicewhich runs atO(n).