这是一个快速排序的 C 语言实现:
#include <stdio.h>
void quick_sort(int *arr, int left, int right) {
if (left >= right) {
return;
}
int pivot = arr[(left + right) / 2];
int i = left - 1;
int j = right + 1;
while (i < j) {
do {
i++;
} while (arr[i]