Content deleted Content added
No edit summary |
heap is almost complete binary tree, not a complete binary tree |
||
Line 75:
[[Image:Binary_tree_in_array.png|right|A small complete binary tree stored in an array]]
However, a more common approach is to store the heap in an array. Any binary tree can be stored in an array, but because a heap is always
The upheap/downheap operations can be stated then in terms of an array as follows: suppose that the heap property holds for the indices ''b'', ''b''+1, ..., ''e''. The sift-down function extends the heap property to ''b''-1, ''b'', ''b''+1, ..., ''e''.
|