Overview
The binary heap data structure is an array object that can be viewed as a complete binary tree.
The primary function used to maintain the max-heap property is MAX_HEAPIFY_DOWN
. This function assumes the left and right- subtrees at a given node are max heaps but that the current node may be smaller than its children. An analagous function and assumptions exist for MIN_HEAPIFY_DOWN
.
Bibliography
- Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).