Circular Queue and Priority Queue
Circular Queue and Priority Queue
Circular Queue is a linear data structure in which the operations are performed based on FIFO (First In First
Out) principle.
The last position is connected back to the first position to make a circle. It is also called ‘Ring Buffer’.
CHARACTERISTICS OF A CIRCULAR QUEUE
Based on FIFO
Has two ends front and rear
Insertion from rear
Deletion from front
OPERATIONS ON CIRCULAR QUEUE:
The list is so created so that the highest priority element is always at the head of the list.
The list is arranged in descending order of elements based on their priority. This allow us to remove the highest
priority element in O(1) time.
To insert an element we must traverse the list and find the proper position to insert the node so that the overall
order of the priority queue is maintained.
This makes the push() operation takes O(N) time.