Skip to content
DSA Visualizerpreview

Min-heap: push and pop

Push sifts up, pop sifts down; watch the tree and its array move together.

O(log n) per push or pop time · O(n) space

Operations50, 20, 70, 10, 40, 5, pop, pop, 30

Start with an empty min-heap: every parent is at most its children.

Empty heap.
  • compare
  • swap or write
  • settled

1 / 31

Speed

Space play · ← → step · Home End jump · drag the strip to scrub