enqueue() or insert() − adding an element at the rear end of the queue
Step 1:if front=-1 then
Print “Queue underflow”
Return.
Step 2: remove the element item = Q[front]
Step 3: if front=rear then
rear=front=-1
else
front=front+1
Step 4:return(item)
- isfull() − Checks if the queue is full.
- isempty() − Checks if the queue is empty.
- Queue Overflow: occurs when an insert operation is performed on a Queue which is already full.
- Queue Underflow: Occurs when a delete operation is performed on an empty queue.
No comments:
Post a Comment