1. 堆排序
引用 make_heap、push_heap、pop_heap、sort_heap使用介绍
默认是大根堆
int main()
{
vector<int> arr = { 20, 43, 21, 1, 6, 30 };
make_heap(arr.begin(), arr.end());//默认大堆
printf("%d", arr.front());//输出堆顶
return 0;
}
引用 make_heap、push_heap、pop_heap、sort_heap使用介绍
默认是大根堆
int main()
{
vector<int> arr = { 20, 43, 21, 1, 6, 30 };
make_heap(arr.begin(), arr.end());//默认大堆
printf("%d", arr.front());//输出堆顶
return 0;
}