A queue is a FIFO (First In First Out) data structure. Similar to any waiting line.

It can be implemented using a Linked List. There are two access points; the top (head) and the bottom (tail). Nodes point towards the tail and new nodes are added to the tail.

Types

Operations

  • push
  • pop
  • peek

Key Algorithms

  • Balanced Parentheses
  • Next Greater Element
  • LRU cache implementation

Common Problems

  • Implement a stack using queues
  • Implement a queue using a stack