Changing a number in a heap
A heap, smallest on top, where a number already inside can change. Look up where it stands, from the note the heap keeps, and write the new number there. If it got smaller it climbs, as a number put in does; if not, it sinks, as a number moved to the top does. Shortest paths and cheapest networks lean on this step.
the row
the row as a tree
- comparisons
- 0
- swaps
- 0
step 1 of 1
Examples