Turbo sort in c++

#include
using namespace std;

int main() {
// your code goes here
int b;
int n,i,k,j;
cin>>n;
int a[n];
if(n<=1000000)
for(i=0;i<n;i++)
cin>>a[i];
while(i<=1000000 && i>=0)
{for(i=0;i<n;i++)
{for(j=i+1;j<n;j++)
{if(a[i]>a[j])
{k=a[i];
a[i]=a[j];
a[j]=k;}

}
cout<<a[i]<<endl;
}
break;
}
return 0;
}
it is giving an error of time limit exceed what does it mean.
How to remove it?

That means your program is not efficient enough so it exceeded the time limit.

Your program is O(n^2), but it should be O(nlogn).

3 Likes