选择排序
2021-02-14 01:18
标签:sed sort event 选择 选择排序 none 技术 click eve 选择排序 标签:sed sort event 选择 选择排序 none 技术 click eve 原文地址:https://www.cnblogs.com/zymmyz/p/12724650.html 1 void selectSort(int array[], int n) {
2 int current;
3 for (current = 0; current current) {
4 int i, min = array[current], minIndex = current;
5 for (i = current; i i) {
6 if (array[i] min) {
7 min = array[i];
8 minIndex = i;
9 }
10 }
11 swap(&array[current], &array[minIndex]);
12 }
13 }