Content deleted Content added
Dennis Brown (talk | contribs) Revert, you broke the citation note |
m →Insert: Copyedit |
||
Line 33:
=== Insert ===
To
# Add the element to the bottom level of the heap at the leftmost open space.▼
# Compare the added element with its parent; if they are in the correct order, stop.▼
# If not, swap the element with its parent and return to the previous step.▼
▲#Add the element to the bottom level of the heap at the leftmost open space.
▲#Compare the added element with its parent; if they are in the correct order, stop.
▲#If not, swap the element with its parent and return to the previous step.
Steps 2 and 3, which restore the heap property by comparing and possibly swapping a node with its parent, are called ''the up-heap'' operation (also known as ''bubble-up'', ''percolate-up'', ''sift-up'', ''trickle-up'', ''swim-up'', ''heapify-up'', ''cascade-up'', or ''fix-up'').
|