Skip to content

Latest commit

 

History

History
67 lines (34 loc) · 1.96 KB

Data_Structures_Questions.md

File metadata and controls

67 lines (34 loc) · 1.96 KB

For each of the methods associated with each data structure, classify it based on its runtime, using Big O notation.

Linked List

  1. 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 addToTail method?

  2. What is the runtime complexity of removeHead?

  3. What is the runtime complexity of contains?

  4. What is the runtime complexity of getMax?

Queue

  1. What is the runtime complexity of enqueue?

  2. What is the runtime complexity of dequeue?

  3. What is the runtime complexity of isEmpty?

  4. What is the runtime complexity of length?

Binary Search Tree

  1. What is the runtime complexity of insert?

  2. What is the runtime complexity of contains?

  3. What is the runtime complexity of getMax?

Heap

  1. What is the runtime complexity of bubbleUp?

  2. What is the runtime complexity of siftDown?

  3. What is the runtime complexity of insert?

  4. What is the runtime complexity of delete?

  5. What is the runtime complexity of getMax?

[Stretch Goal] Doubly Linked List

  1. What is the runtime complexity of ListNode.insertAfter?

  2. What is the runtime complexity of ListNode.insertBefore?

  3. What is the runtime complexity of ListNode.delete?

  4. What is the runtime complexity of DoublyLinkedList.addToHead?

  5. What is the runtime complexity of DoublyLinkedList.removeFromHead?

  6. What is the runtime complexity of DoublyLinkedList.addToTail?

  7. What is the runtime complexity of DoublyLinkedList.removeFromTail?

  8. What is the runtime complexity of DoublyLinkedList.moveToFront?

  9. What is the runtime complexity of DoublyLinkedList.moveToBack?

  10. 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 Array.splice method. Which method generally performs better?