//快排非递归算法
void merge(int a[], int low, int center, int high){//这里的merge与教科书上有不同。我们用两个数组L[],R[]来存储a[]需要合并的两段
int i = 0;
int j = 0;
int k = 0;
int count = 0;
if(low >= high) return;
int m = center - low + 1;
int n = high - center;
int *L = (int *)malloc(sizeof(int)*SCALE);
int *R = (int *)malloc(sizeof(int)*SCALE);
if(!L || !R){
printf("归并排序merge()内存分配故障!");
exit(0);
}
for( count=0; count<=m; count++){
L[count] = a[low+count];
}
for( int count=0; count<=n; count++){
R[count] = a[low+count+m];
}
for(i=0,j=0,k=low; i
a[k] = L[i++];
}
else{
a[k] = R[j++];
}
}
while(i < m){
a[k++] = L[i++];
}
while(j < n){
a[k++] = R[j++];
}
free(L);
free(R);
}
可以等一下嘛,,我这好像有,