QUEUE problem solve.
Consider the following queue of characters where QUEUE is a circular array which is allocated six memory cells:-
FRONT = 2, REAR = 4, QUEUE:
__ , A, C, D, __ , __.
Describe the queue as following operation take place:
(i)
F is added to the queue;
(ii)
Two letters are deleted;
(iii)
K, L, M are added to the queue;
(iv)
Two letter are deleted;
(v)
R is added to the queue;
(vi)
S is added to the queue;
Answer:
QUEUE: __ , A, C,
D, __ , __. FRONT = 2, REAR = 4
(i)
F is added to the queue
QUEUE: __ , A, C, D, F , __ ; FRONT = 2, REAR =
5
(ii)
Two letters are deleted;
QUEUE: __ , __, __, D, F , __ ; FRONT = 4, REAR =
4
(iii)
K, L, M are added to the queue;
QUEUE: L, M ,__ , D, F , K ; FRONT = 4, REAR =
2
(iv)
Two letter are deleted;
QUEUE: L, M ,__ , __, __ , K ; FRONT = 6, REAR = 2
(v)
R is added to the queue;
QUEUE: L, M ,R , __, __ , K ; FRONT = 6, REAR = 3
(vi)
S is added to the queue;
QUEUE: L, M
,R , S, __ , K ; FRONT = 6, REAR =
4
No comments
Dear Members, Thanks for Your Comments. We must be reply your comment answer as soon as possible. Please Stay with us.....