Problem TSORT : Time Exceeds

Inbuilt Quick Sort in c can get you AC.
Heap sort is also working .
Counting sort is also one option with O(n).
Happy coding.

1 Like

Its right that bubble sort uses too much time for execution.

BUT many have submitted using this sort technique successfully so whats the problem with my code.

Nobody would have used bubble sort, i am sure! If u feel that someone has used bubble sort and still submitted successfully, please comment a link of the solution! Bubble sort can never solve this problem. You atleast require an O(nlogn) technique.

1 Like

bro! If you understood please do accept the answer so that we can close the question :slight_smile:

How do we accept an answer??

There will be a tick symbol down to the vote down symbol.

please view my quicksort code in the bottom…

what should i do??

is still giving TLE in quicksort.

this is the basic quick sort. I mean the naive one! Check for the case when the array is reversely sorted. The time complexity will be O(n^2). So use randomized quick sort. You can even use inbuilt sort function which is implemented using quick sort-sort(arr,arr+n) is the syntax of this inbuilt function. Include algorithm header file

1 Like

@kaushik_iitd i implemented it using mergesort and it got AC. As i told -__- CodeChef: Practical coding for everyone

You can view above quicksort submitted by me…i dont think there is any slow i/o method and its still giving TLE.

Fine… let me check

Please accept an answer so that we can close this question.