C语言中的快速排序算法实现

使用C语言实现快速排序算法可以显著提升排序效率。下面是一个示例代码:

#include 

// 函数声明
void quickSort(int arr[], int low, int high);
int partition(int arr[], int low, int high);
void swap(int* a, int* b);

int main() {
    int arr[] = {10, 7, 8, 9, 1, 5};
    int n = sizeof(arr)/sizeof(arr[0]);
    quickSort(arr, 0, n-1);
    printf("Sorted array: 
");
    for(int i=0; i
txt 文件大小:1.51KB