2019 Algorithm

From: 2019-09-30 00:00:00 To: 2019-12-31 00:00:00 Now: 2024-11-15 16:37:13 Status: Public

B - Heap Sort

Time Limit: 1s Memory Limit: 15MB

Submissions: 699 Solved: 253
Description

교재 6장을 참고하여 heap sort를 구현하시오 (오름차순 정렬).

* Heap sort 외의 sorting algorithm (insertion sort, quick sort 등)을 구현할 경우 점수 인정 안됩니다.

Input

line 0: size of array n

line 1~n: array elements, one element per line

Output

line 0~(n-1): array elements sorted in ascending order, one element per line

 
Sample Input
10
4
9
5
7
8
3
6
2
1
0
Sample Output
0
1
2
3
4
5
6
7
8
9