Solution:
Let Q be the array of specified size, SIZE
- Initialize front=0,rear=-1
- Input the value to be inserted and assign to variable "data"
- If (rear > = SIZE)
(a) Display "Queue Overflow"
(b) Exit. - Else
(a) rear=rear+1; - Q[rear]=data;
- Exit
Solution
Let Q be the array of specified size,SIZE
- if (rear < front )
(a) front=0,rear=-1
(b) Display "The queue is empty"
(c) Exit - else
(a) Data=Q[front]
(b) front=front+1; - Exit
No comments:
Post a Comment