(original) (raw)
0 0 0 0 0 0 0 0 1 1 1 1 2 2 3 3 3 3 3 3 3 3 3 2 2 2 2 1 1 0 Bottom-up (siftDown) Top-down (siftUp) The number in the circle indicates the maximum times of swapping required when adding the node to the heap.
0 0 0 0 0 0 0 0 1 1 1 1 2 2 3 3 3 3 3 3 3 3 3 2 2 2 2 1 1 0 Bottom-up (siftDown) Top-down (siftUp) The number in the circle indicates the maximum times of swapping required when adding the node to the heap.