Queue Data Structure

A queue is a linear data structure that follows the First In, First Out (FIFO) principle. Elements are added at the end (rear) of the queue and removed from the front. This structure is analogous to a line of people waiting for service.

Operations

1. Enqueue: Add an element to the rear of the queue.
2. Dequeue: Remove an element from the front of the queue.
3. Peek: View the element at the front of the queue without removing it.

Use Cases

Queues are used in various applications such as scheduling tasks in operating systems, handling requests in web servers, and in breadth-first search algorithms.