We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ae46a2a commit a8e6f8bCopy full SHA for a8e6f8b
2.selectionSort.md
@@ -126,3 +126,25 @@ function selectionSort($arr)
126
return $arr;
127
}
128
```
129
+
130
+## 8. C 代码实现
131
132
+```c
133
+void SelectSort(int *data, int n)
134
+{
135
+ int i, j,t;
136
+ int min_index;
137
+ for(i = 0; i < n - 1; i ++){
138
+ min_index = i;
139
+ for( j = i + 1; j < n; j++){
140
+ if(data[j] < data[min_index])
141
+ min_index = j;
142
+ }
143
+ if (min_index != i){
144
+ t = data[i];
145
+ data[i] = data[min_index];
146
+ data[min_index] = t;
147
148
149
+}
150
+```
0 commit comments