Queue Visualization

Visualize operations on a queue data structure (First-In-First-Out)

Visualization
Visual representation of the queue

The queue is empty

Use the controls to add items

Empty Operation
// Queue is empty
// Use the enqueue operation to add items to the queue
enqueue(item: number) {
this.items.push(item)
return this
}
Operations
Perform operations on the queue
Queue Properties

First-In-First-Out (FIFO)

The first item added to the queue is the first one to be removed.

Time Complexity

Enqueue:O(1)
Dequeue:O(1)
Peek:O(1)

Applications

  • Task scheduling
  • Print job management
  • Breadth-first search
  • Message queues