Skip to content

Queue (FIFO Abstract Data Type)

A FIFO queue adds elements at the rear and removes the earliest still-pending element from the front, independent of its storage implementation.

Version
v2 · 2026-11-14 · History
Domain-specific #
13550
Domain group
Applied Sciences & Engineering
Origin domain
Computer Science & Software Engineering
Subdomain
Data Structures → Computer Science & Software Engineering
Aliases
Fifo Queue, Queue Abstract Data Type

Core Idea

A FIFO queue adds each element at the rear and removes the earliest still-pending element from the front. Peek observes that front element without removal. The abstract data type promises operation order, not a particular array, linked list or other storage layout. Cornell notes that Java's broader Queue interface need not itself require FIFO.[1]

How would you explain it like I'm…

Line for the Slide

A queue is like a line for the slide. The first kid who gets in line is the first kid who gets to go down. New kids join at the back, and you can always see who's at the front.

First In, First Out Line

A queue is a way of keeping a list of things waiting their turn, like a line at a shop. You can add something to the back (enqueue), take the thing at the front away (dequeue), or just look at who's at the front (peek). The rule is "first in, first out": whatever has been waiting longest leaves first. It doesn't matter how the computer stores the line inside, as long as it follows that rule.

FIFO Abstract Data Type

A queue, specifically a FIFO queue, is an abstract data type defined by what its operations do, not how it's built. Enqueue adds an element after all the elements currently waiting, dequeue removes the earliest element still waiting, and peek looks at that element without removing it. The key rule is first in, first out among the elements still present. It can be built with linked nodes, a circular array, or something else; any of these counts as long as it obeys FIFO. Not everything named 'Queue' in programming is a FIFO queue: for instance, Java's Queue interface allows priority-ordered implementations. It's also different from queueing theory, which studies arrivals, waiting and service over time.

 

A FIFO queue is an abstract data type for a pending ordered collection with operations enqueue (add after all currently pending elements), dequeue (remove the earliest pending element), and peek (observe that element without removing it). Its essential contract is first in, first out among elements still present. Representation, whether linked nodes, a circular array, or something else, is not part of the abstract identity; any implementation is an instance only if its operation traces preserve FIFO order. The notion is narrower than every programming interface named Queue: Java's Queue interface, for example, need not guarantee FIFO, since some implementations order by priority. It is also distinct from queueing as a study of arrival, waiting, and service processes, which concerns systems rather than one collection's operation trace.

Scope of Application

Breadth-first search uses a FIFO frontier so earlier discovered vertices are expanded before later distance layers. An MIT producer–consumer character buffer uses read/write indices modulo N to realize FIFO despite array wraparound. Bounded storage must additionally define full/empty behavior; FIFO alone does not say to block or drop.[2][3]

Clarity

Separate the contract from the implementation. A circular buffer stores a queue; a priority queue can have “queue” in its name while returning a later, higher-priority item. The frozen title Queue (data structure) redirects to the ADT page, but both candidate IDs and the distinction remain visible.

Manages Complexity

Clients can reason from one trace rule—oldest pending item leaves next—without tracking internal pointers or indices. That simplification does not guarantee throughput, producer fairness or completion order after removal.

Abstract Reasoning

For enqueue(A), enqueue(B), dequeue(), enqueue(C), dequeue(), a FIFO queue returns A then B. Run similar interleaved traces to test linked, circular or two-stack implementations. In BFS the rule supports distance-layer ordering together with the graph algorithm's discovery rule.[2]

Knowledge Transfer

The same operation contract transfers literally between graph frontiers and character buffers. A physical service line with abandonment or priority overtaking is not automatically this ADT. The live Abstract Data Type is the strict genus; Queueing is a related process concept.

Relationships to Other Abstractions

Local relationship map for Queue (FIFO Abstract Data Type)Parents appear above the current abstraction, mutual partners to the right, and children below. Node labels state whether each abstraction is prime or domain-specific; colors identify relation types.Queue (FIFOAbstract Data Type)DOMAINPrime abstraction: Abstract Data Type — is a kind ofAbstractData TypePRIME

Current abstraction Queue (FIFO Abstract Data Type) Domain-specific

Parents (1) — outgoing typed relations

  • Queue (FIFO Abstract Data Type) is a kind of Abstract Data Type Prime

    The FIFO queue is an abstract data type specified by its operation contract rather than storage implementation.

Hierarchy paths (3) — routes to 2 parentless roots

Neighborhood in Abstraction Space

Queue (FIFO Abstract Data Type) sits in a moderately populated region (54th percentile for distinctiveness): it has near-neighbors but no dense thicket of look-alikes.

Family — Storage & Lookup Data Structures (22 abstractions)

Nearest neighbors

Computed from structural-signature embeddings · 2026-11-14

References

[1] Cornell, Queue ADT reference. registry ↩

[2] MIT, BFS FIFO frontier lecture. registry ↩a ↩b

[3] MIT, N-character FIFO buffer lecture. registry ↩