heap = [5, 8, 0, 3, 6, 7, 9, 1, 4, 2]
heapify(heap)
print heap
heapreplace(heap, 0.5)
print heap
print heapreplace(heap, 10)
print heap
13.21.heapreplace |
| 13.21.1. | heapreplace function pops the smallest element off the heap and then pushes a new element onto it. |