Question
#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
Posted under Object Oriented Programming Using C++
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?
Similar Questions
Discover Related MCQs
Q. How to protect the heap from affecting the memory?
View solution
Q. In what form does the STL provides heap?
View solution
Q. How many types are there in binary heaps?
View solution
Q. Which keyword is used to declare the min and max functions?
View solution
Q. What kind of functions are min and max in c++?
View solution
Q. How many parameters are needed for minmax function?
View solution
Q. Which function is used to return the minimum element in the range?
View solution
Q. Which operator is used to compare the values to find min and max?
View solution
Q. What is meant by permutation in c++?
View solution
Q. How the different permutations are ordered in c++?
View solution
Q. Pick out the correct statement about permutation.
View solution
Q. What is the header file for vector permutation?
View solution
Q. How many parameters are required for next_permutation?
View solution
Q. Pick out the in correct type of function in header file.
View solution
Q. What type of algorithm is not available in creating our own STL style algorithms?
View solution
Q. What is meant by hash tables in C++?
View solution
Q. What is the use of includes function in c++?
View solution
Q. How many parameters are required for sort_heap function?
View solution
Q. How many categories of iterators are there in c++?
View solution
Q. Which of the following can serve as random-access iterator?
View solution
Suggested Topics
Are you eager to expand your knowledge beyond Object Oriented Programming Using C++? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!