Applications of Queues
 Operating system
multi-user/multitasking environments, where
several users or task may be requesting the same
resource simultaneously.
 Communication Software
queues to hold information received over networks
and dial up connections. (Information can be
transmitted faster than it can be processed, so is
placed in a queue waiting to be processed)
 Some other?
Implementation
 Static
Queue is implemented by an array, and size
of queue remains fix
 Dynamic
A queue can be implemented as a linked
list, and expand or shrink with each enqueue
or dequeue operation.
A pointer Implementation of
Queues
Keep two pointers:
 FRONT: A pointer to the first element of the queue.
 REAR: A pointer to the last element of the queue.
x y .
z
Front
Rear
A pointer Implementation of
Queues
Q.front
Q.Rear
MAKENULL(Q)
Q.front
Q.Rear
ENQUEUE(x,Q)
.
x
NULL
Q.front
Q.Rear
ENQUEUE(y,Q)
x .
y
Q.front
Q.Rear
DEQUEUE(Q)
.
y
A pointer Implementation of
Queues

Lec-12, 13 Quee s Applications of Queues

  • 1.
    Applications of Queues Operating system multi-user/multitasking environments, where several users or task may be requesting the same resource simultaneously.  Communication Software queues to hold information received over networks and dial up connections. (Information can be transmitted faster than it can be processed, so is placed in a queue waiting to be processed)  Some other?
  • 2.
    Implementation  Static Queue isimplemented by an array, and size of queue remains fix  Dynamic A queue can be implemented as a linked list, and expand or shrink with each enqueue or dequeue operation.
  • 4.
    A pointer Implementationof Queues Keep two pointers:  FRONT: A pointer to the first element of the queue.  REAR: A pointer to the last element of the queue. x y . z Front Rear
  • 5.
    A pointer Implementationof Queues Q.front Q.Rear MAKENULL(Q) Q.front Q.Rear ENQUEUE(x,Q) . x NULL
  • 6.

Editor's Notes

  • #3 Visit: tshahab.blogspot.com
  • #6 Visit: tshahab.blogspot.com