Solution:-
* Algorithm to insert item into circular queue.
* Algorithm to insert item into circular queue.
Cenque (queue
[maxsize] , item , front , rear)
Step1:- if(front
== (rear+1)% maxsize)
print
“ CIRCULAR QUEUE OVERFLOW “
else
Read
item
if(rear
== -1)
Set
front = 0
Set
rear = 0
else
rear=(rear+1)%
maxsize
End
if
Queue
[rear ]= item
pirnt
“ SUCCESS INSERT ITEM “
End
if
Step2:- stop.
* Algorithm to
delete item in to circular queue.
Cdeque ( queue
[maxsize] , item , front , rear)
Step1:- if(front
== -1)
print
“ CIRCULAR QUEUE UNDERFLOW “
else
item
= queue [front ]
if(front
== rear)
Set front = -1
Set
rear = -1
else
front
= (front+1)%maxsize
End
if
print
“ SUCCESS DELETE ITEM “
End
if
Step2:- stop.