问题:
快速排序
#include<stdio.h> int main(void) { int arr[10] = { 1, 2, 4, 3, 4, 3, 2, 5, 6, 7 }; int len = sizeof(arr) / sizeof(arr[0]); int i = 0; int j = 0; int k = 0; for (i = 0; i < len; i++) { if (arr[i] < arr[i + 1]); for (j = 0; j < len - i -1; j++) { if (arr[j] >= arr[j + 1]) { int tmp = arr[j]; arr[j] = arr[j + 1]; arr[j + 1] = tmp; } } } for (k = 0; k < len; k++) { printf("%d", arr[k]); } }