#include#include #include void swap(int *a,int *b){ int temp=*a; *a=*b; *b=temp; } void insertSort(int a[],int n){ for(int i=1;i =0&&tempa[center]){ swap(&a[left],&a[center]); } if(a[left]>a[right]){ swap(&a[left],&a[right]); } if(a[center]>a[right]){ swap(&a[center],&a[right]); } swap(&a[center],&a[right-1]); return a[right-1]; } void quickSort(int a[],int left,int right){ if(left+5<=right){ int centerValue=getCenterValue(a,left,right); int i=left; int j=right-1; while(1){ while(a[++i] centerValue){ } if(i 欢迎分享,转载请注明来源:内存溢出
快速排序与插入排序结合(C语言,当划分出来的待排元素较少时,可结合插入排序以加快排序时间)
赞
(0)
打赏
微信扫一扫
支付宝扫一扫
py04(循环)
上一篇
2022-12-17
【C++语法地图】+ 运算符重载
下一篇
2022-12-17
评论列表(0条)