Applications of Queue
Applications of Queue
Circular 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’.
In a normal Queue, we can insert elements until queue becomes full. But once
queue becomes full, we can not insert the next element even if there is a space in
front of queue.
1. .
Representation of Deque
Types of Deque
• Input Restricted Deque
In this deque, input is restricted at a single end but allows deletion at both
the ends.
• Output Restricted Deque
In this deque, output is restricted at a single end but allows insertion at both
the ends.
Priority Queue
In this tutorial, you will learn what priority queue is. Also, you will learn
about it's implementations in Python, Java, C, and C++.
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.
Generally, the value of the element itself is considered for assigning the
priority.
For example, The element with the highest value is considered as the
highest priority element. However, in other cases, we can assume the
element with the lowest value as the highest priority element. In other
cases, we can set priorities according to our needs.
Removing Highest
Priority Element
Difference between Priority Queue and Normal Queue