Introduction
The queue data structure follows the FIFO (First In First Out) principle where elements that are added first will be removed first. Queues use an encapsulated object of deque or list as its underlying container, providing a specific set of member functions to access its elements.
Advantages
- Fast insertion, deletion and access operations.
- Useful when a particular service is used by multiple consumers.
- Can be used in the implementation of other data structures.
- Can be used to solve problems that work with recursion (e.g. BFS Algorithm).
Disadvantages
- Limited number of methods.
- Random access of elements is impossible in queues.