Why this code is not getting submitted? It’s compiling properly . Also it’s not showing any kind of test cases failure.
#include<bits/stdc++.h>
using namespace std;
void count_sort(int a[],int n)
{
int largest=a[0];
for(int i=1;i<n;i++)
{
largest=max(largest,a[i]);
}
int freq[largest+1]={0};
for(int i=0;i<n;i++)
{
freq[a[i]]+=1;
}
for(int i=0;i<=largest;i++)
{
while(freq[i]!=0)
{
cout<<i<<" ";
freq[i]--;
}
}
return;
}
int main()
{
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)
{
cin>>a[i];
}
count_sort(a,n);
return 0;
}