AlgoScope

Queue

Data structurebeginnerLinear Structuresalso called FIFO

You join at the back and leave from the front, like a queue at a counter.

Decision · step 5 of 10Queue: Enqueue, dequeue, peek
39frontrearfrontrear

dequeue returns 5: the item that waited longest leaves first.

Open in the player →or start at step 5

What you will see

FRONT -> items -> REAR; enqueue slides in at the rear, dequeue leaves from the front.

How queue works →

Cost

enqueueO(1)
dequeueO(1)
peekO(1)
searchO(n)
SpaceO(n)

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

Queue covers these too, in the same run.