A queue, like a stack, is a type of abstract data type. A queue is an ordered list where data is inserted at one end and deleted from the other end. The end where data is inserted is called the front, and the end where data is deleted is called the rear. A queue follows a specific order, which is why it is referred to as first in first out (FIFO).

The word “queue” means line. All the lines we see around us are actually queue data structures. What happens when we go to see a doctor or get in line to board a vehicle? The one who stands in line first, gets on the vehicle first or sees the doctor first. This is the principle of a queue: the data we put in first is the data we take out first.

For practical purposes, there are several types of queues:

  • Circular queue
  • Double-ended queue, also known as deque
  • Priority queue
0 0 votes
Article Rating
0
Would love your thoughts, please comment.x
()
x