Posted by Abhishek on December 22, 2019


Queues are the most widely used data structures in the real world.

When you have requirements to process something based on the order that you receive them, the ideal choice is to use Queues. The first item to get into the queue will be the first item to go out of the queue. This principle is called FIFO (First In First Out). The items enter into the queue from the BACK and exit from the FRONT.


Operations supported in Queue

  1. Enqueue – to insert an item in the back of the queue
  2. Dequeue – to remove an item from the front of the queue
  3. Peek – to get the item from the front of the queue without removing it
  4. IsEmpty – to check if the queue is empty
  5. IsFull – to check if the queue size is full

The time complexity of all these 5 operations is O(1) because all operations act on the back or front of the queue and not in the middle.

Thanks for reading this post. Enjoy !!
Share on: