Two Ends
Unlike a Stack which only has a Top, a Queue operates on two ends. You insert at the Rear (tail), and you remove from the Front (head).
Loading...
Loading Curriculum...
Loading Subject...
Loading Topic...
Loading Lesson...
Loading Lab...
A linear data structure strictly operating on a First-In-First-Out (FIFO) methodology. The first person to join the line is the first person to be served.
Unlike a Stack which only has a Top, a Queue operates on two ends. You insert at the Rear (tail), and you remove from the Front (head).
Insertion is called Enqueue(). Deletion is called Dequeue(). Viewing the front is called Peek() or Front().
Queues are used anywhere fairness or sequential processing is required: OS thread scheduling, printer spooling, handling web server requests, and Breadth-First Search (BFS).