Re-adjusting a binary heap after removing the minimum element
Posted
by BeeBand
on Stack Overflow
See other posts from Stack Overflow
or by BeeBand
Published on 2010-05-22T11:48:19Z
Indexed on
2010/05/22
11:50 UTC
Read the original article
Hit count: 283
algorithm
|binary-heap
After removing the minimum element in a binary heap, i.e. after removing the root, why is the last leaf then assigned to the root and sifted down?
Why not take the lesser child of what used to be the root and just keep sifting up all the children? Isn't this the same amount of operations, so why is the "sift down" method preferred?
© Stack Overflow or respective owner