#include <stdio.h>
void partition(int a[],int p,int r)
{
int q;
if(p<r)
{
q=quicksort(a,p,r);
partition(a,p,q-1);
partition(a,q+1,r);
}
}
int quicksort(int a[],int p,int r)
{
int pivot=p;
int f=p,temp;
int l=r;
while(f<l)
{
while(a[f]<=a[pivot])
f++;
while(a[l]>a[pivot])
l--;
if(f<l)
{
temp=a[f];
a[f]=a[l];
a[l]=temp;
}
}
temp=a[pivot];
a[pivot]=a[l];
a[l]=temp;
return l;
}
int main(void)
{
// your code goes here
int n;
scanf("%d",&n);
int a[n];
int i;
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
partition(a,0,n-1);
for(i=0;i<n;i++)
{
printf("%d ",a[i]);
}
return 0;
}
This is an algorithm for quicksort my question is whether it takes more time complexity than O(nlogn).