A queue is a first in first out (FIFO) data structure which means first come first serve. It is also known as “waiting lines,” and as the name suggests, it can be easily imagined as a group of people waiting in a line (Figure 5-1).
When a new person comes, he stands at the end of the line conveniently adding data to a queue; the data is placed at the end. The term “enqueue” is used to refer to the act of adding an element to a queue. When extracting data ...
Get Data Structures and Algorithms in Swift: Implement Stacks, Queues, Dictionaries, and Lists in Your Apps now with O’Reilly online learning.
O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.