Question: Use python or JAVA to write the code Problem 1. (20 points) Implement a priority queue. In particular, you are asked to simulate a waiting

Use python or JAVA to write the code
Problem 1. (20 points) Implement a priority queue. In particular, you are asked to simulate a waiting line that forms in front of a bank teller in a typical bank. Different customers have different priorities. A priority queue should support the following functions (you must build these functions): Insert(S.x) inserts the element x into the set S. Maximum(S) returns the element of S with the largest key. Extract_Max(S) removes and returns the element of S with the largest key. Your program should be based on a heap structure. The input must accept each of these three commands in the format shown below (and a "quit command to indicate we are done, though you could also just stop at the end of the file). As an output, should show each max command on a separate line, then the remaining heap (in reverse sorted order) when the program quits. You may assume priorities are integers. This is a sample output.txt file (spaces separating customer names): Alan Sally Sally Alan Paul . . for this input.txt file (one customer and priority per line in this format): insert Paul 2 insert Alan 5 max insert Sue 999 insert Sally 99 extract max quit (Note: You can break ties in any order if their priorities are the same.)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
