Question: Priority Queue Start with the definition of the Queue class and modify it to store integers instead of characters. A special type of queue is

 Priority Queue Start with the definition of the Queue class and

Priority Queue Start with the definition of the Queue class and modify it to store integers instead of characters. A special type of queue is a priority queue. A priority queue behaves like a regular queue except the remove function always extracts the item with the smallest value (this is the item with the highest priority). Create a Priority Queue class that is derived from the Queue class with appropriate constructors. Redefine the remove function in the PriorityQueue class to extract the item with the smallest value. Test the PriorityQueue class by adding several numbers to a PriorityQueue object then remove each one, printing the removed numbers as they are removed from the queue Sample output: Asn #3 by John Smith-Priority Queue Add five integers to queue: #1: 25 #2: 12 #3: 5 #4: 10 #5: -3 Remove the numbers -3 5 10 12 25 Again? (y)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!