Instructions: Answer as many of the following questions as you can during the lab period. If you are unable to complete the assignment during the lab period it is strongly recommended that you complete it on your own.
Getting Ready: Before going any further, you should:
A priority queue is an abstract data type in which each value entered has an associated priority. The highest priority values move to the front of the priority queue. The next value to leave the priority queue is always the value with the highest priority that has been in the priority queue the longest.
One way to implement a priority queue is with a collection of (regular) queues. Each queue holds values of equal priority. When a value enters the priority queue, it is placed in the regular queue that matches its priority; values leave the priority queue starting with the regular queues of highest priority.
PriorityQueue
class
using an array of regular queues. (Note: One of the methods uses
a variable-length parameter list.) Remember to submit your solution.
Driver
.
Copyright 2007