-
What is the output of this program?
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main ()
{
int Array[] = {12, 1, 13, 51, 25};
vector<int> VectorData(Array, Array + 5);
make_heap (VectorData.begin(), VectorData.end());
pop_heap (VectorData.begin(), VectorData.end()); VectorData.pop_back();
VectorData.push_back(50); push_heap (VectorData.begin(), VectorData.end());
sort_heap (VectorData.begin(), VectorData.end());
for (unsigned k = 0; k < VectorData.size(); k++)
{
cout << ' ' << VectorData[k];
}
return 0;
}
-
- 1 12 13 25 50
- 1 12 13 25
- 1 12 13
- 1 12
- 1
Correct Option: A
In this program, We popped out 13 and pushed 50 and then we are sorting that value, So it is printing it.