Heaps and priority queues
1.[2p] What is the heap property of a binary min-heap?
What is the heap property of a binary min-heap?
2.[2p] In an array-based heap indexed from 0, what is the index of the parent of index 40?
In an array-based heap indexed from 0, what is the index of the parent of index 40?
3.[2p] What is the index of the right child of index 12?
What is the index of the right child of index 12?
4.[2p] A heap needs balancing machinery to keep its height at .
A heap needs balancing machinery to keep its height at .
5.[3p] During sift-down, a node must be swapped with the smaller of its two children because
During sift-down, a node must be swapped with the smaller of its two children because
6.[3p] Building a heap costs at most swaps. What does that sum converge to?
Building a heap costs at most swaps. What does that sum converge to?
7.[3p] Which of these are true of heapsort?
Which of these are true of heapsort?
Select all that apply
8.[3p] Finding the 100 largest of a billion items with a size-100 min-heap costs about operations. Give that count in billions.
Finding the 100 largest of a billion items with a size-100 min-heap costs about operations. Give that count in billions.
9.[3p] Match each priority queue implementation to the cost of extracting the minimum.
Match each priority queue implementation to the cost of extracting the minimum.
Unsorted array
Sorted array
Binary heap
Balanced search tree
Show the answer
Unsorted array: Sorted array: Binary heap: Balanced search tree: