Eleven Swaps Not Thirty Four
Take a perfect binary min-heap holding exactly 15 elements, so there are 8 leaves, 4 nodes one level up, 2 above those, and the root.
Building it bottom up runs sift-down at every internal node. A node at height can sink at most levels, and a perfect heap of nodes has nodes at height :
Evaluate that worst case.
Sign in to answer questions and track your progress
Sign In