Question: Sample Input is 5 1 4 1 9 3 2 4 3 Sample Output should be 4 9 Explanation After the first 2 queries, the

 Sample Input is 5 1 4 1 9 3 2 4

Sample Input is

5 1 4 1 9 3 2 4 3 

Sample Output should be

4 9 

Explanation

After the first 2 queries, the heap contains {4,9}. Printing the minimum gives 4 as the output. Then, the 4th query deletes 4 from the heap, and the 5th query gives 9 as the output.

/////////////////////// I do not understand the question or what the code should be. I am supposed to make code that takes input from the computer (no user input). I am also supposed to implement using liked lists. C++ language. ////////////////////////////////////

#include #include #include #include #include using namespace std;

int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ return 0; }

This question is designed to help you get a better understanding of basic heap operations. You will be given queries of 3 types: 1 v Add an element v to the heap "2 v Delete the element v from the heap. "3" Print the minimum of all the elements in the heap NOTE: It is guaranteed that the element to be deleted will be there in the heap. Also, at any instant, only distinct elements will be in the heap. Input Format The first line contains the number of queries, Q Each of the next Q nes contains a single query of any one of the 3 above mentioned types. Constraints s 105 -109 v 109 output Format For each query of type 3, print the minimum value on a single line

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!