Unit II - Queue at CSJMU - 6 Slides Handouts
Unit II - Queue at CSJMU - 6 Slides Handouts
1 2
0 1 2 3 4 5 6 7 8 9
Queue as an ADT -1 -1
Front Rear Representation of queue in memory
A queue of elements of any particular type is a 0 1 2 3 4 5 6 7 8 9
finite sequence of elements of that type 0 4 5 7 12 8 9
Front Rear Representation of queue in memory
together with the following operations:
0 1 2 3 4 5 6 7 8 9
Initialize a queue to be empty.
2 4 12 8 9
Determine if queue is empty or not. Front Rear Representation of queue in memory
Determine if queue is full or not 0 1 2 3 4 5 6 7 8 9
If queue is not full, then insert a new element after 2 7 12 8 9 3 10 11
the last element in a queue. Front Rear Representation of queue in memory
If queue is not empty, then retrieve the first element 0 1 2 3 4 5 6 7 8 9
of a queue. 2 9 12 8 9 3 10 11 15 20
If queue is not empty, then delete the first element Front Rear Representation of queue in memory
from a queue. 0 1 2 3 4 5 6 7 8 9
0 8 12 8 9 3 10 11 15 20 60
Unit II - Queues 3 Dr. Rabins Porwal UnitFront
II - Queues Rear Representation
4 of queue in memory
Dr. Rabins Porwal
3 4
5 6
7 8
9 10
Unit II - Queues 11 Dr. Rabins Porwal Unit II - Queues 12 Dr. Rabins Porwal
11 12
Unit II - Queues 13 Dr. Rabins Porwal Unit II - Queues 14 Dr. Rabins Porwal
13 14