Queue
A first-in, first-out (FIFO) data structure where elements are added at the back and removed from the front.
Also: priority queue
Definition
A queue is an abstract data type following the First-In, First-Out (FIFO) principle, where the element inserted first is the first to be removed. Core operations are enqueue (add to rear), dequeue (remove from front), and peek (view front), typically O(1). Queues model real-world waiting lines and are essential for scheduling, breadth-first search, message passing, and task management. Priority queues extend this by ordering elements by priority rather than insertion order.
Example
“A print spooler maintains a queue of print jobs, processing them in the order received so the first document submitted prints before later ones, regardless of page count.”
Synonyms
- FIFO structure
- waiting line
- message queue structure
Antonyms / Opposites
- stack
- LIFO structure
Images
CC-licensed · free to useVideo
Related Terms
- data-structure
- message-queue
- algorithm
- stack-data
