AlgoScope

Enqueue

AlgorithmbeginnerQueue Patterns

Add an item at the rear. It waits behind everything already there.

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

The item slides in at the REAR.

How queue works →

Cost

BestO(1)
AverageO(1)
WorstO(1)
SpaceO(1)

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, predict what happens next, try operations in any order.

Screen readers: Items announce position from the top or front and value; each step announces the operation and the new top or front.

Reduced motion: Items appear or disappear in place with a crossfade instead of sliding in or out.

Before this

Taught by the same lesson

Queue covers these too, in the same run.