Linear time complex sorting

Please check the code.
Its working fine for one test case

#include
using namespace std;

void LinearTimeSort(int a[], long long int n){
int s=0;
int m=0;
long long int e=n-1;
while(m<=e){
if (a[m]==0){
swap(a[m],a[s]);
m++;
s++;
}
else if(a[m]==1){
m++;
}
else{
swap(a[m],a[e]);
e–;
}
}
}

int main(){
long long int n;
cin>>n;
int a[1000];
for(int i=0;i<n;i++){
cin>>a[i];
}
LinearTimeSort(a,n);
for(int i=0;i<n;i++){
cout<<a[i]<<endl;;
}
return 0;
}

instead of a[1000], use a[1000000]

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.