下面的快速排序哪儿错了,郁闷。。。
#include"stdio.h"typedef int Bool;
int split(Bool a[],int low,int high);
void quicksort(Bool a[],int low,int high);
int main()
{
Bool a[100];
int i,j;
printf("输入要排列的数据(小于100)【输入0时结束输入】:\n");
for(i=0;;i++)
{
scanf("%d",&a[i]);
if(a[i]==0)break;
}
quicksort(a,0,(i-1));
for(j=0;j<i;j++)
printf("%3d",a[j]);
return 0;
}
int split(Bool a[],int low,int high)
{
Bool basic;
basic=a[low];
for(;;)
{
for(;basic<=a[high]&&low<high;)
high--;
a[low++]=a[high];
for(;basic>=a[low]&&low<high;)
low++;
a[high--]=a[low];
if(low>=high)break;
}a[high]=basic;
return high;
}
void quicksort(Bool a[],int low,int high)
{
int mid;
if(low>high)return;
mid=split(a,low,high);
quicksort(a,low,mid-1);
quicksort(a,mid+1,high);
}