Reqflow
Stack & Queue·Beginner

Queue: Enqueue, Dequeue, Front

Time O(1) per opSpace O(n)
·

A queue is a First-In First-Out (FIFO) data structure. Elements are added at the rear (enqueue) and removed from the front (dequeue). A peek at the front element is called front(). All three operations are O(1) in a proper implementation using a circular buffer or doubly-ended linked list. Queues are the backbone of BFS traversal, task scheduling, and message passing systems.

Example: Watch enqueue, dequeue, and front operations on a live queue.

When to use this

See also

← All algorithms