Queues: Ref.: D.S. Malik, Data Structures Using C++
Queues: Ref.: D.S. Malik, Data Structures Using C++
Queues
add adding an item to the back of a queue delete removing an item from the front of a queue
queueFront = 0 queueRear = 0
[99]
queueFront = 0 queueRear = 2
[99]
queueFront = 1 queueRear = 2
[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] A B C D E F G H I J
[99]
queueFront = 7 queueRear = 9
queueFront = 97 queueRear = 99 We need to program the queue so that it can continue to operate.
[99]
[0]
queueFront = 98
queueRear = 99
Student exercise: Add Z. Redraw the queue and give the values of the variables.
queueFront = 98
queueRear = 0