Skip to content

Latest commit

 

History

History
20 lines (13 loc) · 549 Bytes

02-06-queue.md

File metadata and controls

20 lines (13 loc) · 549 Bytes

Queue

Example

Cashier lines

A small market has a cashier. When people want to buy things, they form a line and pay one at a time. This line is a queue.

A supermarket may have many cashiers, and each can have its own line. Each of these acts on its own.

If instead we form a single line that is shared by all cashiers, we will have a single line, and each of the cashiers would take the next one, in the same order they were ready.

Definition

A queue is a list where things are taken out in the same order they were added.