adplus-dvertising
frame-decoration

Question

What is the output of this program?
    #include <iostream>
    #include <algorithm>
    #include <vector>
    using namespace std;
    int main () 
    {
        int myints[] = {10, 20, 30, 5, 15};
        vector<int> v(myints, myints + 5);
        make_heap (v.begin(), v.end());
        pop_heap (v.begin(), v.end()); v.pop_back();
        v.push_back(99); push_heap (v.begin(), v.end());
        sort_heap (v.begin(), v.end());
        for (unsigned i = 0; i < v.size(); i++)
            cout << ' ' << v[i];
        return 0;
    }

a.

5 10

b.

5 10 15 20

c.

5 10 15 20 99

d.

None of the mentioned

Answer: (c).5 10 15 20 99

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program?