💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、豆包、星火、月之暗面及文生图、文生视频 广告
~~~ void swap(int *a,int *b){ int temp; temp = *a; *a = *b; *b = temp; } int partition(int *a,int p,int r){ int x = a[r]; int i = p-1; for(int j=p;j<r;j++){ if(a[j]<=x){ i++; swap(&a[i],&a[j]); } } swap(&a[i+1],&a[r]); return i+1; } void quickSort(int *a,int p,int r){ if(p<r){ int q = partition(a,p,r); quickSort(a,p,q-1); quickSort(a,q+1,r); } } ~~~