Heaps & Priority Queues


Answer & solution
Answer: D (no official key was published)
1. The candidate frontier contains the roots of all unexplored subheaps. Heap order makes its minimum the smallest unseen element. Extract that node and add at most its two children, preserving the invariant. After seven iterations the frontier and work are bounded by constants independent of n.
2. Maintain a small candidate min-priority queue initially containing the root. Repeatedly remove its minimum and insert that node’s children; after seven removals the extracted value is seventh smallest. Only a constant number of nodes and candidate operations are used because rank 7 is fixed, hence Θ(1) with respect to n, D, assuming n≥7. Repeatedly deleting from the original n-element heap is unnecessarily expensive.