Skip to content

Queue: Dequeue

Task: Remove the value at the front

frontrear275RETURNED12no longer waiting

What you are watching

Dequeueing removes the value at the front and returns it. 12 had been waiting longest, so 12 leaves first, and everything behind it moves forward one place - 27 becomes the front and 5 moves up behind it. Nothing overtakes and nothing is skipped: the only value that can leave is the one that has been waiting longest.