#include <vector>
#include <algorithm>
#include <iostream>
/*Heap Sort с применением стандартных средств языка*/
void heapsort_std(int a[], int size){
std::vector<int> v;
v.assign(a, a + size); //Добавили все элементы массива в вектор
std::cout << "vector:\n";
for(int i = 0; i < size; i++)
std::cout << v[i] << ' ';
std::cout << '\n';
//Сортировка
}
int main() {
int v[10] = {7, 1, 3, 6, 5, 8, 9, 4, 0, 2};
heapsort_std(v, 10);
for(int i = 0; i < 10; i++)
std::cout << v[i] << ' ';
return 0;
}
ICAgICNpbmNsdWRlIDx2ZWN0b3I+CiAgICAjaW5jbHVkZSA8YWxnb3JpdGhtPgogICAgI2luY2x1ZGUgPGlvc3RyZWFtPgogICAgIAogICAgLypIZWFwIFNvcnQg0YEg0L/RgNC40LzQtdC90LXQvdC40LXQvCDRgdGC0LDQvdC00LDRgNGC0L3Ri9GFINGB0YDQtdC00YHRgtCyINGP0LfRi9C60LAqLwogICAgdm9pZCBoZWFwc29ydF9zdGQoaW50IGFbXSwgaW50IHNpemUpewogICAgCXN0ZDo6dmVjdG9yPGludD4gdjsKICAgICAKICAgIAl2LmFzc2lnbihhLCBhICsgc2l6ZSk7CS8v0JTQvtCx0LDQstC40LvQuCDQstGB0LUg0Y3Qu9C10LzQtdC90YLRiyDQvNCw0YHRgdC40LLQsCDQsiDQstC10LrRgtC+0YAKICAgIAlzdGQ6OmNvdXQgPDwgInZlY3RvcjpcbiI7CiAgICAJZm9yKGludCBpID0gMDsgaSA8IHNpemU7IGkrKykKICAgIAkJc3RkOjpjb3V0IDw8IHZbaV0gPDwgJyAnOwogICAgCXN0ZDo6Y291dCA8PCAnXG4nOwogICAgCS8v0KHQvtGA0YLQuNGA0L7QstC60LAKICAgIH0KICAgICAKICAgIGludCBtYWluKCkgewogICAgCWludCB2WzEwXSA9IHs3LCAxLCAzLCA2LCA1LCA4LCA5LCA0LCAwLCAyfTsKICAgIAloZWFwc29ydF9zdGQodiwgMTApOwogICAgCWZvcihpbnQgaSA9IDA7IGkgPCAxMDsgaSsrKQogICAgCQlzdGQ6OmNvdXQgPDwgdltpXSA8PCAnICc7CiAgICAJcmV0dXJuIDA7CiAgICB9