Next: 2.4.3 Circular Linked List Implementation
Up: 2.4 Queues
Previous: 2.4.1 Pointer Implementation
See Figure 2.10.
- Rear of the queue is somewhere clockwise from the front
- To enqueue an element, we move rear one position clockwise and write the
element in that position
- To dequeue, we simply move front one position clockwise
- Queue migrates in a clockwise direction as we enqueue and dequeue
- emptiness and fullness to be checked carefully.
Figure 2.10:
Circular array implementation of a queue
|
eEL,CSA_Dept,IISc,Bangalore