Java Reference
In-Depth Information
1. A heap is almost complete: all nodes are filled in, except the last level may
have some nodes missing toward the right (see Figure 16 ).
2. The tree fulfills the heap property: all nodes store values that are at most as
large as the values stored in their descendants (see Figure 17 ).
It is easy to see that the heap property ensures that the smallest element is stored in
the root.
A heap is an almost complete tree in which the values of all nodes are at most as
large as those of their descendants.
Figure 16
An Almost Complete Tree
740
Search WWH ::




Custom Search