What ordering does a min-heap guarantee?
Answer & explanation
Answer: Each parent is no greater than its children
The local heap property exposes the minimum at the root without fully sorting the remaining elements.
Trace arrays, searching, sorting, stacks, trees, graphs, and algorithm complexity.
A random set of up to 10 questions from Data Structures & Algorithms. Your answers stay on this page.
Open a topic above to explore the complete question bank.
Answer: Each parent is no greater than its children
The local heap property exposes the minimum at the root without fully sorting the remaining elements.
Answer: O(1)
The minimum is stored at the root and can be read directly.
Answer: O(log n)
The new element may move up through the tree’s logarithmic height.
Answer: O(log n)
After replacing the root, sifting down restores the heap property along at most one root-to-leaf path.
Answer: O(n)
Most nodes are near leaves and require little repair, making bottom-up heapification linear.
Answer: A min-heap of at most k retained values
The smallest retained candidate is quickly removed when a larger candidate arrives.