정렬
정렬 알고리즘이 단계별로 실행되는 모습을 지켜보세요 - 배열이 정렬될 때까지 요소를 비교하고 교환하고 배치합니다.
Insertion SortWatch insertion sort build a sorted section one element at a time.Selection SortSee selection sort repeatedly pick the smallest element and place it.Merge SortWatch merge sort divide the array and merge the pieces back in order.Bubble SortSee adjacent elements compared and swapped until the array is sorted.Quick SortWatch quick sort partition around a pivot and recurse on each side.Heap SortSee heap sort build a max-heap and extract the largest element each time.Radix SortWatch radix sort order numbers digit by digit, from least significant.Counting SortSee counting sort tally values and rebuild the array in sorted order.
정렬 비교
| 알고리즘 | 최선 | 평균 | 최악 | 공간 | 안정 |
|---|---|---|---|---|---|
| Insertion Sort | O(n) | O(n²) | O(n²) | O(1) | Yes |
| Selection Sort | O(n²) | O(n²) | O(n²) | O(1) | No |
| Merge Sort | O(n log n) | O(n log n) | O(n log n) | O(n) | Yes |
| Bubble Sort | O(n) | O(n²) | O(n²) | O(1) | Yes |
| Quick Sort | O(n log n) | O(n log n) | O(n²) | O(log n) | No |
| Heap Sort | O(n log n) | O(n log n) | O(n log n) | O(1) | No |
| Radix Sort | O(nk) | O(nk) | O(nk) | O(n + k) | Yes |
| Counting Sort | O(n + k) | O(n + k) | O(n + k) | O(n + k) | Yes |