Exploring queues
A queue is a pattern that is frequently used in computer science to implement a first in first out (FIFO) data buffer. The first thing to come into the queue is also the first thing to leave. This happens in an ordered fashion in order to process sorted data. Adding things to the queue is known as enqueueing the data into the queue, and removing it from the end of the queue is known as dequeuing. Queues are commonly used as a fixture in which data is stored and processed at another time.
Queues are beneficial because they don't have a fixed capacity. A new element can be added to the queue at any time, which makes a queue an ideal solution for asynchronous implementations such as a keyboard buffer or a printer queue. Queues ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access