大神们帮帮我我也不知道哪错了,就是无法正常的排出序来,这是快排的
#include <stdio.h>int partions(int l[],int low,int high)
{
int prvotkey=l[low];
l[0]=l[low];
while (low<high)
{
while (low<high&&l[high]>=prvotkey)
--high;
l[low++]=l[high];
while (low<high&&l[low]<=prvotkey)
++low;
l[high--]=l[low];
}
l[low]=l[0];
if(low<high)
{
partions(l,low,high+1);
partions(l,prvotkey-1,high);
}
}
void main()
{
int a[11]={0,2,32,43,23,45,36,57,14,27,39},c,b;
partions(a,1,10);
for ( b=1;b<11;b++)
printf("\n");
for( c=1;c<11;c++)
printf("%3d",a[c]);
}
我也不知道那错了,就是无法正常的排出序来
这是快排的