Deletion Algorithm for dequeue
Step 1: [check for underflow]
If front = 0 and rear = 0
Output "underflow" and return
Step 2: [delete element at front end]
If front > 0
Value = q [front]
Return [value]
Step 3: [check queue for empty]
If front = rear
Front = rear = 0
Else
Front = front +1
Step 4: [delete element at the rear end]
If rear > 0
Value = Q [rear]
Return (rear)
Step 5: [check queue for empty]
If front = rear
Front = rear = 0
Else
Rear = rear - 1
Step 6: Return