Skip to content

Resource · Guide or article

Queue

One-paragraph definition of the FIFO queue: enqueue adds at the rear, dequeue removes from the front, and peek reads the front item.

Reviewed

Open the original: Queue (opens the original site in a new tab)

Add to a roadmap

Keep this resource with a roadmap you follow. It appears as your own extra resource; the roadmap's steps don't change and it doesn't count toward your tracked steps.

Source content: English

Read this in other languages: 简体中文, Русский, 日本語, Français, Português, 한국어, Українська In computer science, a queue is a particular kind of abstract data type or collection in which the entities in the collection are kept in order and the principle (or only) operations on the collection are the addition of entities to the rear terminal position, known as enqueue, and removal of entities from the front terminal position, known as dequeue. This makes the queue a First-In-First-Out (FIFO) data structure. In a FIFO data structure, the first element added to the queue will be the first one to be removed. This is equivalent to the requirement that once a new element is added, all elements that were added before have to be removed before the new element can be removed. Often a peek or front operation is also entered, returning the value of the front element without dequeuing it. A queue is an example of a linear data structure, or more abstractly a sequential collection. Representation of a FIFO (first in, first out) queue

PrepKit overview

PrepKit editors wrote and reviewed this overview from the source repository. It is not text from the resource itself.

Suited to
The source does not state a level
Format
Reference

What it covers

  • FIFO ordering rule and the optional peek operation
  • Diagram of a FIFO queue

How to use it

PrepKit study advice, not a claim made by the source.

Implement a queue with two stacks and explain why each element moves between them at most once.

Scope and limitations

No complexity table, implementation discussion or exercises appear on the page.

Access and format

Short README on GitHub, trekhleb/javascript-algorithms (MIT), with seven translations linked. English, free.

Reviewed by PrepKit on Oct 2, 2026. Listing source commit: 85293e3e2b88

Evidence behind this overview
  • src/data-structures/queue/README.md

Pages that include this

Get the PrepKit newsletter

Optional. You don't need it to use PrepKit.

How we handle your email