Skip to content

Latest commit

 

History

History
40 lines (31 loc) · 1.2 KB

module07-quiz.md

File metadata and controls

40 lines (31 loc) · 1.2 KB

Module 7: Heaps

In this module, we will cover heap operations, priority queues, and top K problems. You will learn how to implement and utilize heaps to solve various problems.

Topics Covered

  • Heap operations
  • Priority queues
  • Top K problems

Key Problems

  • Kth Largest Element in Array
  • K Closest Points to Origin
  • Min Cost to Connect Sticks

Quiz

  1. What is the time complexity of inserting an element into a max heap?

    • A) O(1)
    • B) O(log n)
    • C) O(n)
  2. How do you find the Kth largest element in an unsorted array?

    • A) Sort the array and return the Kth element
    • B) Use a min heap of size K
    • C) Both A and B
  3. What is a priority queue?

    • A) A queue that processes elements in FIFO order
    • B) A data structure that allows for the efficient retrieval of the highest (or lowest) priority element
    • C) A stack that follows LIFO order
  4. In a max heap, which of the following statements is true?

    • A) The parent node is always smaller than the child nodes
    • B) The parent node is always larger than the child nodes
    • C) All nodes are arranged in ascending order
  5. What is the minimum cost to connect all sticks of lengths 1, 2, 3, and 4?

    • A) 9
    • B) 10
    • C) 7