0
22kviews
What are different types of queues?
1 Answer
1
401views

Queue : Queue is a linear data structure in which removal of elements is done in the same order they were inserted i.e., the element will be removed first which is inserted first.

A queue has two ends which are front end and rear end. Insertion is take place at rear end and deletion is take place at front end. Queue is also known as first in first out (FIFO) data structure. Queue can be classified into following types:

• Circular Queue

• Priority Queue

• De-queue

Circular Queue:

In a normal Queue, we can insert elements until queue becomes full. But once queue becomes full, we cannot insert the next element even if there is a space in front of queue. Circular Queue is designed to overcome the limitation of Simple Queue.

Circular Queue is a linear data structure in which the operations are performed based on FIFO (First In First Out) principle and the last position is connected back to the first position to make a circle. It is also called ‘Ring Buffer’.

enter image description here

DeQueue:

enter image description here

Double ended queue allows insertion and deletion from both the ends i.e. elements can be added or removed from rear as well as front end.

There are two variations in Dequeue:

• Input restricted deque: In input restricted double ended queue, the insertion operation is performed at only one end and deletion operation is performed at both the ends.

enter image description here

• Output restricted deque: In output restricted double ended queue, the deletion operation is performed at only one end and insertion operation is performed at both the ends.

enter image description here

Priority Queue:

Priority queue is a type of queue where each element has a priority value and the deletion of the elements is depended upon the priority value. In case of max-priority queue, the element will be deleted first which has the largest priority value and in case of min-priority queue the element will be deleted first which has the minimum priority value.

Please log in to add an answer.