2
#include
#include
void interchange(int* m,int* n)
{
int temp=*m;
*m=*n;
*n=temp;
}
int partition(int array[],int p,int q)
{
int i,j;
i=p;
j=q+1;
while(1)
{
do i++;
while((array[i]
while((array[j]>array[p])&&(j!=p));
if(i
else
break;
}
interchange(&array[p],&array[j]);
return j;
} }
void quicksort(int array[],int p,int q)
{
int j;
if (p {
j=partition(array,p,q);
quicksort(array,p,j-1);
quicksort(array,j+1,q);
}
}
void main()
{
int n,i;
cout<<"please input the number of array:";
cin>>n;
int* a=(int*)malloc(n*sizeof(int));
for(i=0;i
cout<<"please the "< cin>>a[i];
}
cout<<"before sort:";
for(i=0;i
cout<<"after sort:";
for(i=0;i