Search

Queue

A queue is a linear data structure which models real world queues by having two primary operations, namely enqueue and dequeue. Queue is known for its First-in-First-out (FIFO) structure.

Queue Terminology

Enqueue = Adding = Offering
Dequeue = Polling

Time Complexity of Queue

Enqueue: O(1)
Dequeue: O(1)
Peeking: O(1)
Contains: O(n)
Removal: O(n)
Is Empty: O(1)

Examples

Waiting List
Server Request Management
Breadth First Search (BFS) graph traversal

Reference