Carefully observe the below given queue
|
REAR |
22 |
57 |
96 |
68 |
19 |
15 |
28 |
FRONT |
How many dequeue operations needed to delete the largest element from the queue?
Deletion takes place at the FRONT of the queue.
96 is the largest element in the given queue.
1st deque operation:
|
REAR |
22 |
57 |
96 |
68 |
19 |
15 |
FRONT |
28 is deleted
2nd deque operation:
|
REAR |
22 |
57 |
96 |
68 |
19 |
FRONT |
15 is deleted
3rd operation:
|
REAR |
22 |
57 |
96 |
68 |
FRONT |
19 is deleted
4th operation:
|
REAR |
22 |
57 |
96 |
FRONT |
68 is deleted
5th operation:
|
REAR |
22 |
57 |
FRONT |
96 is deleted
Therefore, the number of deque operation needed to delete 96 is 5.
