AlgorithmsCodingDataStructures A queue is a linear data structure that is based on FIFO (first-in first-out) ordering. It can be implemented using a linked list.

Complexity:
Add: O(1)
Remove: O(1)
Access: O(n)

A queue is useful in the following situations:

  • Implementing a cache
  • Breadth-first search - (view nodes in order they are added)