Write an algorithm of priority circular queue Deletion.

Priority circular queue Deletion:

  • In priority circular queue deletion first we check whether queue is empty. If the queue is empty we show “the queue is empty ” and return.
  • in second condition we check if the front and rear are on (0) index so we delete the value and shift front and rear on (-1)
  • If the front is on last point so we shift the front on (0) index because it,s a circular queue.
  • in last step if the front is anywhere so we delete the value using it,s priority.

 Algorithm:

P CQDeletion(Queue,N,F,R,P)
(1) [Start]
(2) [Check For Empty]
If F= -1 Then
Show “ Queue is Empty”
Return
[End of If step 2]
(3) Delete Queue[P] [F]
(4) [Check Condition]
If R=F Then
F=R= -1
Else If F= N -1 Then
F=0
Else
F=F+1
[End Of If Else step 4]
(5)[Return]

Leave a Reply

Your email address will not be published. Required fields are marked *