Content deleted Content added
Partially undid revision 1292801804 by Ajmullen (talk) – restored the shorter and more comprehensible variant |
Added missing space complexity - it was not only missing but produced a poorly formatted page. |
||
Line 1:
{{Short description|Variant of heap data structure}}
{{Infobox data structure
| name = Binary (min) heap
| type = binary tree/heap
| invented_by = [[J. W. J. Williams]]
| invented_year = 1964
<!-- NOTE:
For the purposes of "Big O" notation, all bases are equivalent, because changing the base of a log only introduces a constant factor.
Line 10:
DO: O(log n)
DON'T: O(lg n), O(log2 n), O(log_2 n), O(ln n), O(log10 n), etc.
-->| insert_worst = O(log ''n'')▼
| insert_avg = O(1)▼
▲|insert_worst=O(log ''n'')
▲|insert_avg=O(1)
|
|
|
| find_min_avg = O(1)
▲|decrease_key_worst=O(log ''n'')
|
| merge_avg = O(''n'')
|
|
| space_worst = O(n)
}}
[[File:Max-Heap.svg|thumb|right|Example of a complete binary max-heap]]
[[File:Min-heap.png|thumb|right|Example of a complete binary min heap]]
|