Percolate down/sift down a binary heap heuristic
Is there any optimizations in choosing which child node to percolate down in a binary heap? For example, in a min heap, if the parent no开发者_StackOverflowde was 10 and its children was 8 and 3 what would be the better node to swap with?
Choosing to swap with the larger child seems like it would increase the likelihood of stopping since child nodes below it would be greater than 8. Has there been any research done on this?
I realized this was a silly question as swapping with the larger element would actually violate the min heap property because 8 would have a child which has value 3.
精彩评论