AlgoScope

Priority Queue

Data structureintermediateLinear Structures

Always hands back the highest-priority item, usually by keeping a binary heap underneath.

Decision · step 3 of 6Binary Heap: Insert climbs to the root
94821017current7 < 1

1 is smaller than its parent 7, so they swap.

Open in the player →or start at step 3

What you will see

Items enter at the next free slot and climb; the best one is always the root.

How binary heap works →

Cost

insertO(log n)
extract topO(log n)
peekO(1)
SpaceO(n)

Depends on representation; bounds shown are for a binary heap.

How you work with it here

play it through, step one change at a time, scrub to any step, run it on your own input, try operations in any order.

Screen readers: Each element is an accessibility element with position, value and state; structural changes are announced per step.

Reduced motion: Elements appear at their destination with a crossfade; no travel longer than the element's own size.

Before this

Taught by the same lesson

Binary Heap covers these too, in the same run.