Each list below is the level-order contents of a complete binary tree stored in a 0-indexed array, so the children of index ii sit at indices 2i+12i+1 and 2i+22i+2. Which list is a valid binary min-heap?

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

An array-based binary min-heap contains nn distinct keys. A key comparison, array access, or swap takes constant time. Choose constant, logarithmic, or linear to complete each statement about the tight worst-case running time as nn grows.

  • Inspecting the minimum without removing it takes time.
  • Searching for an arbitrary key when its index is unknown takes time.
  • Decreasing a key and restoring heap order, when its index is supplied, takes time.
  • Constructing a heap from an arbitrary array using bottom-up sift-down takes time.

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

A binary min-heap is stored in a 0-indexed array, so the parent of index ii is at index ⌊(i−1)/2⌋\lfloor (i-1)/2 \rfloor. The array currently holds:


3, 7, 5, 12, 9, 8, 10, 15, 14


The key 4 is inserted using the standard method: append it at the end of the array, then sift it up. Give the final index of the key 4, the number of swaps performed, and the value stored at index 4 after the insertion. Answer each as a whole number.

Your answers

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

Extra Practice