4815162342
AlgoPlus//structures / priority-queue
Read the theory

Priority Queue · Min-Heap

The smallest value is always at the root — insert sifts up, extract sifts down.

Size
6
Min (root)
4
Legend
Comparing
Swapping
Node
AI Tutor Workspace
In a nutshell
A priority queue always hands you the most important item next, not the one that arrived first. It's usually built on a min-heap — a tree where every parent is smaller than its children, so the smallest (highest-priority) value sits at the root, always one peek away. Adding an item lets it bubble up to its rightful level, and removing the top pulls a leaf up and lets it sink down, each in about log-n steps. It powers schedulers, Dijkstra's shortest paths, and event simulations.
Ready
Press play to begin the cinematic walkthrough.
A min-heap keeps the smallest element at the root, so the highest-priority item is always one peek away. Insert sifts up, extract sifts down.
Key terms
Go deeper in the lesson
Read the full theory, intuition & complexity for Priority Queue · Min-Heap.