Min Heap

0

0 votes
Easy
Problem

You need to implement min heap on the given element.

INPUT FORMAT:

There will be two lines in input .

First line contains number of quiries,

Next line contains tests

Test 1:

A num will be given ,we need to insert the number and heapify it.

Test 2:

extract the root element and heapify it.

Test 3:

You need to return the size of heap tree.

Test 4:

You need to return the top(root)  element.

OUTPUT FORMAT:

The output will contain single line.

No need to print any output for test1 and test2.

Test 3:

Print the size of heap in output.

Test 4:

You need to print the top element in output.

SAMPLE INPUT:

9

1 3

1 7

1 2

1 6

3

4

3

4

 

SAMPLE OUTPUT:

4

2

3

3

Time Limit: 5
Memory Limit: 256
Source Limit:
Editor Image

?