Skip to main content

Heapify

Learn Heapify (Heap, Data Structures & Algorithms) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

What Does Heapify Do? Heapify restores the heap property at ONE node, ASSUMING both its children are already valid heaps - it "sinks" the node down, swapping with its smaller (min-heap) or larger (max-heap) child, until the property holds locally. This single-node operation is the building block for both building a whole heap and for extraction.

More lessons in Heap