Skip to content

Commit 3d8db06

Browse files
woo-jkPanquesito7
andauthored
Added Korean explanation of Heap Sort + Fix typo (#158)
* Korean translation of Bubble Sort * Korean translation of Bubble Sort * Added Korean explanation of Heap Sort + Fix typo * Update 버블정렬.md * Update ko/정렬/힙정렬.md Co-authored-by: David Leal <[email protected]> * Update ko/정렬/버블정렬.md Co-authored-by: David Leal <[email protected]> Co-authored-by: David Leal <[email protected]>
1 parent 151ca88 commit 3d8db06

File tree

3 files changed

+89
-20
lines changed

3 files changed

+89
-20
lines changed

en/Sorting Algorithms/Heap Sort.md

+19-19
Original file line numberDiff line numberDiff line change
@@ -23,35 +23,35 @@ or O(n) (equal keys) Best-case performance
2323

2424
`O(1)` Worst case auxiliary
2525

26-
2726
#### Example
28-
```
27+
28+
```
2929
Input data: 4, 10, 3, 5, 1
30-
4(0)
31-
/ \
32-
10(1) 3(2)
33-
/ \
34-
5(3) 1(4)
30+
4(0)
31+
/ \
32+
10(1) 3(2)
33+
/ \
34+
5(3) 1(4)
3535
3636
The numbers in bracket represent the indices in the array
3737
representation of data.
3838
3939
Applying heapify procedure to index 1:
40-
4(0)
41-
/ \
42-
10(1) 3(2)
43-
/ \
40+
4(0)
41+
/ \
42+
10(1) 3(2)
43+
/ \
4444
5(3) 1(4)
4545
4646
Applying heapify procedure to index 0:
47-
10(0)
48-
/ \
49-
5(1) 3(2)
50-
/ \
51-
4(3) 1(4)
47+
10(0)
48+
/ \
49+
5(1) 3(2)
50+
/ \
51+
4(3) 1(4)
5252
The heapify procedure calls itself recursively to build heap
53-
in top down manner.
54-
```
53+
in top down manner.
54+
```
5555

5656
![heap-image](https://upload.wikimedia.org/wikipedia/commons/1/1b/Sorting_heapsort_anim.gif "Heap Sort")
5757

@@ -68,4 +68,4 @@ The heapify procedure calls itself recursively to build heap
6868

6969
#### Video Explanation
7070

71-
[A video explaining the Selection Sort Algorithm](https://www.youtube.com/watch?v=MtQL_ll5KhQ)
71+
[A video explaining the Heap Sort Algorithm](https://www.youtube.com/watch?v=MtQL_ll5KhQ)

ko/정렬/버블정렬.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,4 @@
101101

102102
#### 애니메이션 설명
103103

104-
- [Tute Board](https://boardhub.github.io/tute/?wd=bubbleSortAlgo2)
104+
- [튜트 보드](https://boardhub.github.io/tute/?wd=bubbleSortAlgo2)

ko/정렬/힙정렬.md

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# 힙 정렬
2+
3+
#### 문제
4+
5+
정렬되지 않은 n개의 원소로 이루어진 배열이 주어졌을 때, 배열을 정렬하는 함수를 작성하라
6+
7+
#### 접근방식
8+
9+
- 입력 데이터에서 최대 힙을 빌드한다.
10+
- 이때, 가장 큰 원소가 힙의 루트에 저장된다. 해당 원소를 힙의 마지막 원소로 교체한 뒤, 힙의 사이즈를 1 줄인다.
11+
- 힙의 사이즈가 1보다 크다면 위 과정을 반복한다.
12+
13+
#### 시간 복잡도
14+
15+
`O(n log n)` 최악의 경우
16+
17+
`O(n log n)` (고유 키)
18+
or O(n) (동일 키) 최선의 경우
19+
20+
`O(n log n)` 평균 복잡도
21+
22+
#### 공간 복잡도
23+
24+
`O(1)` 최악의 경우
25+
26+
#### 예시
27+
28+
```
29+
입력 원소 : 4, 10, 3, 5, 1
30+
4(0)
31+
/ \
32+
10(1) 3(2)
33+
/ \
34+
5(3) 1(4)
35+
36+
괄호 안의 숫자는 데이터의 배열 인덱스를 나타낸다.
37+
38+
1번 인덱스에 힙 절차 적용 :
39+
4(0)
40+
/ \
41+
10(1) 3(2)
42+
/ \
43+
5(3) 1(4)
44+
45+
0번 인덱스의 힙 절차 적용:
46+
10(0)
47+
/ \
48+
5(1) 3(2)
49+
/ \
50+
4(3) 1(4)
51+
힙 절차는 재귀적으로 호출하여 하향식 방식으로 힙을 빌드한다.
52+
```
53+
54+
![힙 이미지](https://upload.wikimedia.org/wikipedia/commons/1/1b/Sorting_heapsort_anim.gif)
55+
56+
#### 코드구현
57+
58+
- [자바](https://github.com/TheAlgorithms/Java/blob/master/Sorts/HeapSort.java)
59+
- [C++](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/sorting/heap_sort.cpp)
60+
- [파이썬](https://github.com/TheAlgorithms/Python/blob/master/sorts/heap_sort.py)
61+
- [](https://github.com/TheAlgorithms/Go/blob/master/sorts/heapsort.go)
62+
- [루비](https://github.com/TheAlgorithms/Ruby/blob/master/sorting/heap_sort.rb)
63+
- [C-sharp](https://github.com/TheAlgorithms/C-Sharp/blob/master/Algorithms/Sorters/Comparison/HeapSorter.cs)
64+
- [C](https://github.com/TheAlgorithms/C/blob/master/sorting/heap_sort.c)
65+
- [자바스크립트](https://github.com/TheAlgorithms/Javascript/blob/master/Sorts/HeapSort.js)
66+
67+
#### 영상 설명
68+
69+
[힙 정렬 알고리즘에 대한 영상 설명](https://www.youtube.com/watch?v=MtQL_ll5KhQ)

0 commit comments

Comments
 (0)