快速排序算法
跟网上的其他版本几乎一模一样 不知道怎么就是调试不出结果 求大神们看看
程序代码:#include<iostream>
using namespace std;
int Part(int* a,int low,int high){
int temp=a[low];
int j=high,i=low;
while(low<high){
while(a[high]>=temp&&high>low){
high--;
}
a[low]=a[high];
while(a[low]<=temp&&high>low){
low++;
}
a[high]=a[low];
}
a[low]=temp;
return low;
}
void qsort(int* a,int low,int high){
int pivotpos;
while(low<=high){
pivotpos=Part(a,low,high);
qsort(a,low,pivotpos-1);
qsort(a,pivotpos,high);
}
}
int main(){
int sort[10]={23,29,18,89,5,0,35,23,67,78};
qsort(sort,0,9);
for(int i=0;i<10;i++){
cout<<sort[i];
}
system("pause");
return 0;
}









