Data Structures: Queues
- Is a Linear data structure
- Operations can only be performed at the end of the structure and not in the middle.
- Enqueue: Add an item to the back of the queue.
- Dequeue: Take in item from the front of the queue.
First In First Out (FIFO)
A queue data structure works the same as a queue of people, in the sense that the first person who entered the queue will be the first person out of the queue.
The first item put in the queue is the first item taken out.
After the above Enqueues the queue will look like this:
When you dequeue the queue, the first item out of the queue will be "A".
- var val = queue.Dequeue(); // val = "A"