Stack & Queue
FIFO queue operations and circular queue wrap-around
Stack & Queue: Queue
Queue
Pick a queue operation to animate the FIFO behavior.
Queue Patterns
Enqueue adds to the rear, while Dequeue removes from the front.
Peek inspects the front item without mutating the queue state.
Circular Queue reuses freed slots by wrapping `front` and `rear` with modulo arithmetic.
Complexity
Enqueue
Time:O(1)
Space:O(1)
Dequeue
Time:O(1)
Space:O(1)
Peek
Time:O(1)
Space:O(1)
Circular Queue
Time:O(1)
Space:O(capacity)