Concept Flow - Heapify operation
Start at index i
Find left and right child indices
Compare parent with children
Is parent smallest/largest?
Yes→Done
No
Swap parent with smallest/largest child
Repeat heapify at swapped child's index
End
Heapify fixes the heap property starting from a node by comparing it with its children and swapping if needed, then continuing down the tree.