Home » C++ Programming » Questions and Answers » Question
  1. What is the output of this program?
     #include <iostream>
    #include <algorithm>
    #include <vector>
    using namespace std;
    int main ()
    {
    int num[] = {6, 7, 8, 9 ,10};
    vector<int> VectorData(num, num + 5);
    VectorData.push_back(100);
    push_heap (VectorData.begin(),VectorData.end());
    cout << VectorData.front() << '\n';
    sort_heap (VectorData.begin(),VectorData.end());
    return 0;
    }
    1. 6, 7, 8, 9 ,10
    2. 6, 7, 8, 9
    3. 100
    4. 6, 7, 8
    5. 6, 7
Correct Option: C

In this program, We are pushing a new value into heap and printing it.



Your comments will be displayed only after manual approval.