Suppose that items are inserted into a min priority queue
with the order and priorities:
((A, 2), (B, 3), (C, 1), (D, 2), (E, 1))
In what order are the items removed from the queue?
A: A, B, C, D, E
B: C, E, A, D, B
C: B, A, D, C, E
D: E, C, D, A, B
E: C, E, D, A, B
Answer: B
After the insertions, the queue will contain:
1: C, E
2: A, D
3: B
The priority 1 items will be processed in order, followed by Priority 2 and 3.
Contents
Page-10
Prev
Next
Page+10
Index