Neural Ninjas · DSA Simulation Labs · Lab 45

♨️ The Heap Sifter

A node out of place bubbles toward where it belongs, one real swap at a time. Sift down: trade places with the better child, again and again, until both children finally agree. Sift up: trade with the parent until it does too.

Sift Log

Controls

♨️ Sifting NodeI check my children (sifting down) or my parent (sifting up), and swap the instant the heap rule is broken. I keep going until nobody wants to trade with me anymore.
📐 The Heap RuleMin-heap: every parent must be smaller than both children. Max-heap: every parent must be bigger. One broken pair anywhere means the whole heap needs fixing.
Pick a level above to begin.