question https://hack.codingblocks.com/contests/c/512/389
#include
using namespace std;
int partition(long long int a[],int s,int e){
int j=s;
int i=s-1;
for ( ;j<e;j++){
if(a[j]<a[e]){
i++;
swap(a[i],a[j]);
}
}
swap(a[i+1],a[e]);
return i+1;
}
void quicksort (long long int a[],int s,int e){
if(s>=e){
return ;
}
int p = partition(a,s,e);
quicksort(a,s,p-1);
quicksort(a,p+1,e);
}
int main() {
long long int a[1000005];
long long int n;
cin>>n;
for (int i=0;i<n;i++){
cin>>a[i];
}
quicksort(a,0,n-1);
for(int i=0;i<n;i++){
cout<<a[i]<<" ";
}
return 0;
}
test case no. 3 showing time limit exceded and other test cases passed