Queue Abstract Data Type

A queue ADT supports two main operations:

  • enqueue which adds an element to the data structure
  • dequeue which removes the least recently added element that was not yet removed

The order in which elements are removed gives rise to the term FIFO (first in, first out) to describe a queue.

It helps to visualize a queue as an ADT where elements are removed from the front but added to the back, analogously to when people line up to wait for goods or services.

A queue has a variety of applications such as:

  • Serving requests on a shared resource, like a printer, CPU, etc.
  • Any application that follows a "first come, first served" policy, e.g. customer-service, call-center/ticketing system, etc.
  • Whenever it is necessary to preserve sequencing order
Resources