Solution:-
v
INSERTION OF
ITEM
ü
AT REAR END
Insrear (queue
[maxsize ],item , front , rear )
Step1:- if
(rear == maxsize -1)
printf “
QUEUE OVERFLOW “
Other wise
Read item
If ( front ==rear== -1)
{
Set rear= -1
Set front = -1
}
Other wise
Set rear = rear + 1
End if
Set
queue[rear]=item
print “ SUCCESS INSERT ITEM “
End if
Step2:- stop.
ü
AT FRONT END
Step1:- if(front
== 0)
print
“ QUEUE OVERFLOW “
else
Read
item
front
= front -1
queue[front]=item
End
if
Step2:- stop
v
DELETION OF
ITEM
ü
DELETION FROM
FRONT END
Step1:- if(front == -1)
print
“ QUEUE UNDERFLOW “
else
Set item = queue [front]
if(rear
== front)
Set front = -1
Set rear = -1
else
Set front = front +1
End
if
Print
“ SUCCESS DELETE ITEM “
End
if
Step2:- stop.
ü
DELETION FROM
REAR END
Delrear (queue[maxsize] , item , front , rear)
Step1:- if(rear
== -1)
print
“ QUEUE UNDERFLOW “
else
item
= queue[rear]
if(rear
== front)
{
Set
front = -1
Set
rear = -1
}
else
rear
= rear -1
End
if
End
if
Step2:- stop
ü
DISPLAY FUNCTION
Display
(queue[maxsize ] , i , rear , front)
Step1:- if(rear
== -1)
print “ NO ITEM”
else
for(i=front;
i<=rear; i++)
print
(“ %d \t “ queue[ i ])
End
if
Step2:- stop