Algorithm to delete an element from a queue
Step 1: IF FRONT = -1 OR FRONT > REAR
SET VAL = QUEUE[FRONT]
SET FRONT = FRONT+1
[END OF IF]
Step 2: EXIT
- In Step 1, we check for underflow condition. An underflow occurs if FRONT = –1 or FRONT > REAR. However, if queue has some values, then FRONT is incremented so that it now points to the next value in the queue.