make_heap 和 push_heap 的区别

#include
#include
#include
#include
using namespace std;

int main()
{
int a[]={5,1,9,4,6,2,0,3,8,7};
make_heap(a,a+10,less());
cout<<"make_heap:";
copy(a,a+10,ostream_iterator(cout," "));
cout<

int b[]={5,1,9,4,6,2,0,3,8,7};
vector heap;
for(int i=0;i<10;i++)
{
heap.push_back(b[i]);
push_heap(heap.begin(),heap.end(),less());
}
cout<<"push_heap:";
copy(heap.begin(),heap.end(),ostream_iterator(cout," "));
cout<
return EXIT_SUCCESS;
}
make_heap <wbr>和 <wbr>push_heap <wbr>的区别



你可能感兴趣的:(make_heap 和 push_heap 的区别)