suppose we have the heap
now we extract the node (root) which represents the maximum value and
now we get
We now have to make this back into a heap. We can almost run the heapify
procedure on the whole thing, except that we have two complete binary
trees, not one.
Hint:
to make the 2 trees back into a single tree, move one of the nodes
from one of the trees to the root. But, which one could you move and
then call heapify on the result to get back a single heap?
A