1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
int SelectionSort(int arr[]) {
    for (int i = 0; i < SIZE - 2; i++) {
        int* min = &arr[i];
        for (int j = i+1; j < SIZE; j++) {
            if (*min > arr[j]) *min = arr[i];
        }
 
        Swap(min, &arr[i]);
    }
 
    cout << "SelectionSort" << endl;
    Print(arr);
 
    return 0;
}
cs


'알고리즘' 카테고리의 다른 글

SelectionSearch  (0) 2018.05.26
InsertSort  (0) 2018.05.26
BubbleSort  (0) 2018.05.26
MergeSort  (0) 2018.05.26
Quick Sort  (0) 2018.05.26

+ Recent posts