1. You are required to complete the code of our MedianPriorityQueue class. The class should mimic the behaviour of a PriorityQueue and give highest priority to median of it's data. 2. Here is the list of functions that you are supposed to complete 2.1. add -> Should accept new data. 2.2. remove -> Should remove and return median value, if available or print "Underflow" otherwise and return -1 2.3. peek -> Should return median value, if available or print "Underflow" otherwise and return -1 2.4. size -> Should return the number of elements available 3. Input and Output is managed for you. Note -> If there are even number of elements in the MedianPriorityQueue, consider the smaller median as median value.
Input Format
Input is managed for you
Output Format
Output is managed for you
Constraints
None
Notice
Try First, Check Solution later
1. You should first read the question and watch the question video.2. Think of a solution approach, then try and submit the question on editor tab.3. We strongly advise you to watch the solution video for prescribed approach.Example
Input
add 10 add 20 add 30 add 40 peek add 50 peek remove peek remove peek remove peek remove peek quit
Output
20 30 30 20 20 40 40 10 10 50