Queues
First in first out.
A queue is a data structure where the first in line is the first to leave. Similar to waiting in line at the store or waiting in queue to play a video game.
The person in the front of the line is served first. Unlike the “LIFO” structure in stacks, queues follow something called “FIFO” or first in first out.
With queues, we can access the front or back of the list and remove or add from opposite ends. For example, add to the end of the list and remove from the front.
Queues can be used as buffers and async functions.
Later in this course, we will create something called a priority queue using a data structure called a heap.