#include <vector>
#include <algorithm>
#include <iostream>
/*Heap Sort с применением стандартных средств языка*/
void heapsort_std(int a[], int size){
std::vector<int> v;
v.assign(a, a + sizeof(a)/sizeof(a[0])); //Добавили все элементы массива в вектор
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;
}
I2luY2x1ZGUgPHZlY3Rvcj4KI2luY2x1ZGUgPGFsZ29yaXRobT4KI2luY2x1ZGUgPGlvc3RyZWFtPgoKLypIZWFwIFNvcnQg0YEg0L/RgNC40LzQtdC90LXQvdC40LXQvCDRgdGC0LDQvdC00LDRgNGC0L3Ri9GFINGB0YDQtdC00YHRgtCyINGP0LfRi9C60LAqLwp2b2lkIGhlYXBzb3J0X3N0ZChpbnQgYVtdLCBpbnQgc2l6ZSl7CglzdGQ6OnZlY3RvcjxpbnQ+IHY7CgoJdi5hc3NpZ24oYSwgYSArIHNpemVvZihhKS9zaXplb2YoYVswXSkpOwkvL9CU0L7QsdCw0LLQuNC70Lgg0LLRgdC1INGN0LvQtdC80LXQvdGC0Ysg0LzQsNGB0YHQuNCy0LAg0LIg0LLQtdC60YLQvtGACglzdGQ6OmNvdXQgPDwgInZlY3RvcjpcbiI7Cglmb3IoaW50IGkgPSAwOyBpIDwgc2l6ZTsgaSsrKQoJCXN0ZDo6Y291dCA8PCB2W2ldIDw8ICcgJzsKCXN0ZDo6Y291dCA8PCAnXG4nOwoJLy/QodC+0YDRgtC40YDQvtCy0LrQsAp9CgppbnQgbWFpbigpIHsKCWludCB2WzEwXSA9IHs3LCAxLCAzLCA2LCA1LCA4LCA5LCA0LCAwLCAyfTsKCWhlYXBzb3J0X3N0ZCh2LCAxMCk7Cglmb3IoaW50IGkgPSAwOyBpIDwgMTA7IGkrKykKCQlzdGQ6OmNvdXQgPDwgdltpXSA8PCAnICc7CglyZXR1cm4gMDsKfQ==