#include <iostream>
#include <queue>
using namespace std;
void HeapSort(int arr[], int MAX) {
priority_queue<int, vector<int>, greater<int>> a;
// 오름차순으로 나타나게함
for (int i = 0; i < MAX; i++) {
a.push(arr[i]);
}
for (int i = 0; i < MAX; i++) {
arr[i] = a.top();
a.pop();
}
}
int main() {
int MAX = 5;
int* arr = new int[MAX] { 1, 3, 2, 4, 5 };
HeapSort(arr, MAX);
for (int i = 0; i < 5; i++) {
cout << arr[i] << endl;
}
}