I am trying to solve TSORT by making use of inbuilt function qsort in C. this is my solution. The solution gives the right answer even with the number to be sorted as large as 10^7 on my machine. What is that I am missing?

Your sort function seems to be right but, you missed something in this statement.

long long *a=(long long *)malloc(t);

You, have to pass the size of long long in malloc(). Hope, it helps

1 Like