导读 void selectSort(int* data, int max) { int m, temp; for (int i = 0; i < max - 1; i++) { m = i; for (int j = i + 1; j
void selectSort(int* data, int max) { int m, temp; for (int i = 0; i < max - 1; i++) { m = i; for (int j = i + 1; j <= max - 1; j++) { if (data[j] < data[m]) m = j; } if (m != i) { temp = data[i]; data[i] = data[m]; data[m] = temp; } printf("第 "+(i+1)+" 次排序:"); for(int k=0;k<=max-1;k++){ printf(data[k]+" "); } printf(""); } }。