一:功能
堆排序
二:用法
cpp
#include <iostream>
#include <vector>
#include <algorithm>
int main() {
std::vector<int> data = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
std::make_heap(data.begin(), data.end());
for (auto v : data)
std::cout << v << " ";
std::cout << "\n";
std::sort_heap(data.begin(), data.end());
for (auto v : data)
std::cout << v << " ";
std::cout << "\n";
}