Binary heap: Difference between revisions

Content deleted Content added
Extract: (non-visible) HTML-only comment "not a typo" (i.e., sic.)
Heap operations: ce: word choice, “conform to” seemed to allow that the heap was somehow out of conformance prior to the operation; “preserve” is better because it emphasizes that, of the two definitional properties, ‘shape’ is the one that is more fragile/intractable to repair, and that is why it is the one that must be “preserved” first.
Tags: Mobile edit Mobile web edit
Line 35:
 
==Heap operations==
Both the insert and remove operations modify the heap to conform topreserve the shape property first, by adding or removing from the end of the heap. Then the heap property is restored by traversing up or down the heap. Both operations take {{nowrap|O(log ''n'')}} time.
 
=== Insert ===