AlgoViz

Heap properties

easy 16 min

A binary heap is a complete binary tree in which every parent is greater than or equal to its children (max-heap) or less than or equal to them (min-heap).

A heap inspector: index helpers, validation and height

Read it, run it, change a line and run it again.

Loading editor…

Works for max-heaps and min-heaps. The check walks every parent-child edge once, so it is O(n); everything else is O(1).