#844 – The Queue Data Type
May 15, 2013 1 Comment
A queue is a data type used to store a collection of items and which has the following properties:
- Elements can be added to the queue
- Elements can be removed from the queue, but only in the order in which they were added
Adding an item is known as a Enqueue operation. Removing an item is known as a Dequeue operation.
You can think of a queue data type as being like people standing in a line. You can enter the line only at the back (Enqueue) and you can leave the line, but only from the front (Dequeue).
A queue is also known as a FIFO (First-In, First-Out) structure.