Types of Queue

Types of Queue

In this tutorial, you will learn different types of queue along with illustration.

A queue is a useful data structure in programming. It is similar to the ticket queue outside a cinema hall, where the first person entering the queue is the first person who gets the ticket.

There are four different types of queue in data structure. Let's discuss them below.


Simple Queue

In a simple queue, insertion takes place at the rear and removal occurs at the front. It strictly follows FIFO rule.

Simple queue
Simple Queue Representation

To learn more, visit Queue Data Structure.


Circular Queue

In a circular queue, the last element points to the first element making a circular link.

Circular queue
Circular Queue Representation

The main advantage of a circular queue over a simple queue is better memory utilization. If the last position is full and the first position is empty then, an element can be inserted in the first position. This action is not possible in a simple queue.

To learn more, visit Circular Queue Data Structure.


Priority Queue

A priority queue is a special type of queue in which each element is associated with a priority and is served according to its priority. If elements with the same priority occur, they are served according to their order in the queue.

Priority queue
Priority Queue Representation

Insertion occurs based on the arrival of the values and removal occurs based on priority.

To learn more, visit Priority Queue Data Structure.


Deque (Double Ended Queue)

Double Ended Queue is a type of queue in which insertion and removal of elements can be performed from either from the front or rear. Thus, it does not follow FIFO rule (First In First Out).

Double ended queue
Deque Representation

To learn more, visit Deque Data Structure.