For each of the methods associated with each data structure, classify it based on its worst-case runtime, using Big O notation.
-
What is the runtime complexity of
add_to_tail
?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
add_to_tail
method? -
What is the runtime complexity of
remove_head
? -
What is the runtime complexity of
contains
? -
What is the runtime complexity of
get_max
?
-
What is the runtime complexity of
enqueue
? -
What is the runtime complexity of
dequeue
? -
What is the runtime complexity of
len
?
-
What is the runtime complexity of
insert
? -
What is the runtime complexity of
contains
? -
What is the runtime complexity of
get_max
?
-
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
? -
What is the runtime complexity of
ListNode.insert_before
? -
What is the runtime complexity of
ListNode.delete
? -
What is the runtime complexity of
DoublyLinkedList.add_to_head
? -
What is the runtime complexity of
DoublyLinkedList.remove_from_head
? -
What is the runtime complexity of
DoublyLinkedList.add_to_tail
? -
What is the runtime complexity of
DoublyLinkedList.remove_from_tail
? -
What is the runtime complexity of
DoublyLinkedList.move_to_front
? -
What is the runtime complexity of
DoublyLinkedList.move_to_end
? -
What is the runtime complexity of
DoublyLinkedList.delete
?a. Compare the runtime of the doubly linked list's
delete
method with the worst-case runtime of the JSArray.splice
method. Which method generally performs better?