• Julian's Globe

    QUEUE

    A queue is a collection of items insterted and removed in a particular manner. It can be thought of as waiting in line for something. The key property to understand about queues is that the first item inserted into the queue is naturally the first one to come out.

    One good example is to think of a queue like waiting in line to buy groceries. The first person which was in line is the first person to buy groceries, and then the second person and so on. This is where the term FIFO comes in; it just stands for First In First out. In this example, the first person in line is the first person who gets to purchase their groceries, hence also the first person out of line. You use the queue data structure when your problem involves data needed to be stored and retrieved in this manner.