Chapter quiz · Heaps & Priority Queues

Test what you learned.

8 questions on Heaps & Priority Queues. Pass 70% to clear the chapter.

← Review chapter lessons

Quiz

Heaps — Chapter Quiz

Eight questions on heap shape, heap property, sift operations, build-heap, priority queue uses, top-k, and two-heap median.

0/ 9
  1. Question 1
    1

    Which two properties together define a valid binary max-heap?

  2. Question 2
    2

    In an array-backed binary heap, if a node is at index i (0-indexed), where are its children?

  3. Question 3
    3

    What is the time complexity of building a heap from an unsorted array of n elements using Floyd's algorithm (the heapify-all approach)?

  4. Question 4
    4

    What is the most efficient approach to find the top k largest elements in an unsorted array of n elements?

  5. Question 5
    5

    The two-heap technique for finding the running median uses:

  6. Question 6
    6

    Inserting a new element into a heap (sift-up) always takes O(log n) time in the worst case.

  7. Question 7
    7

    A heap can be used to implement a ___ queue, a data structure that always dequeues the element with the highest (or lowest) priority.

  8. Question 8
    8

    Which operations run in O(log n) on a binary heap? (Select all that apply)

    Select all that apply.

Pick an answer — instant feedback as you go.