Queue
queues are FIFO
Things we can do:
- Enqueue adds an item at the end
- Dequeue removes an item from the front
- Check Size checks the size of a queue
- Check if empty sees first element is NULL
- get first element
A queue, in contrast, is a sequentially ordered data structure that uses the first in, first out (FIFO) principle: items are removed from a queue in the order in which they were inserted. There are many everyday examples of queues, including shoppers waiting in a checkout line at a store and cars waiting in line at a traffic signal. Queues are also quite common in operating systems—jobs that are sent to a printer are typically printed in the order in which they were submitted, for example. As we shall see in the chapter CPU Scheduling, tasks that are waiting to be run on an available CPU are often organized in queues.