Question: 1. (100 marks] Priority queue is a data structure similar to a regular queue. The difference is that remove () method removes the element with

 1. (100 marks] Priority queue is a data structure similar to

1. (100 marks] Priority queue is a data structure similar to a regular queue. The difference is that remove () method removes the element with the highest priority. There are several implementations of priority queues. In this exercise, we will assume, for simplicity but without loss of generality, that priority queue stores integers and that the element with the highest priority is smallest the one. Implementation A: the insert(int) method inserts elements into priority queue in ascending order. The remove () method then simply removes the element at head. Implementation B: the insert(int) method is exactly the same as in the case of regular queues. The remove () method removes the smallest entry in the queue. Implement both versions of priority queues. Also, write drivers Lab3a.java and Lab3b.java for both implementations

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!