The preceding heap has this property:
- For every node other
than a leaf, its key value is less than (or equal to) that of its
children.
(A heap could also be arranged so that the key of every node is
greater
than that of its children.)
Compare this property to the binary search tree property:
- For every node other
than a leaf, its key value is greater than (or equal to) the key of every
node in its left sub-tree and less than (or equal to) the key of every
node in its right sub-tree
(Example).
The binary search tree property imposes a total ordering on all of its
nodes.
The heap property imposes a partial ordering on all of its nodes, but
a total ordering on the nodes of each branch.