#include <iostream>
#include <cassert>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
vector<int> vector1(5);
for (int i = 0; i < 5; ++i)
vector1[i] = i;
// Shuffle the elements again:
random_shuffle(vector1.begin(), vector1.end());
make_heap(vector1.begin(), vector1.end());
sort_heap(vector1.begin(), vector1.end());
// Verify that the array is sorted:
for (int i = 0; i < 5; ++i)
cout << vector1[i];
return 0;
}
|