본문 바로가기

프로그래밍/알고리즘 스터디

[알고리즘] Stable sorting algorithm, In-Place algorithm

Stable Sorting Algorithm (안정 정렬 알고리)

- 크기가 같은 데이터가 정렬된 이후에도 입력된 순서를 그대로 유지하게 하는 정렬 알고리즘이다.

 

Stable Sorting Algorithm

Bubble Sort
Insertion Sort
Cocktail Shaker
Merge Sort

 

Unstable Sorting Algorithm

Selection sort
Heap Sort
Shell Sort
Quick Sort
Exchange
Comb

 


In-place Algorithm

- 입력 데이터를 저장하는 메모리 이외는 상수 크기의 메모리만 필요한 알고리즘이다.

- 정렬을 하는 과정에서 추가적인 메모리 공간이 "거의" 안든다고 생각하면 쉽다.

- Quick Sort의 경우는 정의에 따라서 Not in place sorting으로 볼 수도 있으나 보통은 In-place로 분류한다.

 

In-Place algorithm 정리