Figure 2: Restoring the heap property. Node 5 must be moved since it is larger than both of its sons. It switches places with its smallest son, in this case, the left one. After the swap, node 5 is smaller than both of its sons (6 and 8), and the heap property is completely restored.