Help me Please [Turbo Sort] Run time Error [SIGSEGV]

#include<stdio.h>
int main()
{
int count,i,t,j,u,temp;
int num[50];

scanf("%d", &count);
 
	for(t=0; t<count; t++)
	{
		scanf("%d", &num[t]);
	}
 
	for(i=0;i<count;i++)
	{
		for(t=0;t<count-1;t++)
		{
			if(num[t]>num[t+1])
			{
			temp=num[t];
			num[t]=num[t+1];
			num[t+1]=temp;
			}
		}
	}

	for(j=0;j<count;j++)
	{
		printf("%d\n",num[j]);
	}

return 0;
}

can someone tell me how to fix my coding??
its saying run time error [SIGSEGV]

In nested for loop, before if(condition) statement
for(t=0;t<count-1;t++), instead of “count-1”, put “count-i” as
for(t=0;t<count-i;t++)
and then run your program.

1 Like

still Runtime Error(SIGSEGV)
it dont work :frowning:

You are declaring array of size 50. Instead declare it 1000000 like,

num[1000000];

This will give TLE since you are using the sorting algorithm which have O(n^2) of complextiy.

for declaring array of size 1000000 use
unsigned int num[100000];

increase size of the array size.and enter no. of values below the size of the array.

//