Skip to content

Queue: Peek

Task: Read the front value without removing it

frontrear12275AFTER THE PEEK12275

What you are watching

Peek returns the value at the front and leaves the queue exactly as it was. It is the operation that separates looking from taking: after a peek all three values are still waiting and 12 is still at the front. Only the front can be read this way - there is no operation that reaches past it to 27 or 5.