Write An algorithm of circular Queue Deletion.

Circular Queue Deletion:

  • In circular queue deletion first we check if the Front is on (-1) so we print “The operation cannot be performed”.
  • in second condition we check if Rear and Front are equal it means they are on first index  so we shift the rear and front on (-1) and delete the value.
  • In third step if the front is on (N-1) so we increment in front because it,s a circular queue and there is no last edge.
  • In 4th step if the front is any where so we increment in front and delete the value.

Algorithm:

CQDeletion(Queue,N,F,R)
(1) [Start]
(2) [Check For Empty]
If F= -1 Then
Show “ Queue is Empty”
Return
[End of If step 2]
(3) Delete Queue [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 *