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](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f3e8a52fd5d_83666f3e8a4c5330.jpg)
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
Get step-by-step solutions from verified subject matter experts
