#include<algorithm>
#include<iostream>
#include<functional>
int main()
{
int A[4] = {10, 200, 5, 100};
make_heap(A, A +4);
cout<<"Elements of the Heap \n";
copy(A, A + 4, ostream_iterator<int>(cout, " "));
cout<<endl;
sort_heap(A,A+4);
cout<<"Elements of the Heap after sorting\n";
copy(A,A +4, ostream_iterator<int>(cout,""));
}
make_heap(first, last);: Converts the range given by first to last into a heap sort_heap(first,last);: This turns a heap(first,last) into assorted range.