Write an algorithm of linear queue Deletion.

Linear Queue Deletion:

  • linear queue deletion operation we delete the data sequentially from the front side.
  • In linear queue deletion first we check whether the queue is empty.
  • If the queue is (-1) then we  print “Queue is empty”.
  • In second condition we check if Rear and front are equal. It means data is available on first index so we delete the first index and shift the Front and Rear on (-1) .
  • In 3rd condition we simply shift the front in next index and delete the value.

Algorithm:

LQDeletion(Queue,N,F,R)
(1) [Start]
(2) [Check For Empty]
If R= -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
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 *