순열
-
[자료구조] 1-3. 알고리즘 예시 & 재귀 함수 (C/C++)50 shades of ZZ/C(++) 자료구조 마스터 2023. 9. 27. 21:38
[알고리즘 예시] Selection Sort 선택 정렬 문제 : Sort a set of n ≥ 1 integers in non-decreasing order 방법 : from those integers that are currently unsorted, find the smallest and place it next in the sorted list pseudocode algorithm for(i = 0; i < n - 1; i++){ 1. list[i]와 list[n-1] 비교 / 가장 작은 값은 list[min]에 대입 2. list[i]와 list[min] 교환 } #define SWAP(x, y, t) \\ ((t)=(x), (x)=(y), (t)=(t)) void sort(int list[],..