+ 4

What is the best sorting algorithm ?

There are so many sorting algorithms . I want to know which one is the best . And what algorithm is applied in build-in sort function of various IDEs ,like codeblocks. ??

28th Apr 2018, 1:47 AM
Nieb Hasan
Nieb Hasan - avatar
4 Respostas
+ 4
It depends what you're sorting, and what is known about the data you're sorting. What assumptions can be made about the data, in order to optimise a particular search algorithm. Also note, there's luck involved. A bad sorting algorithm will sometimes be better than a better one, if it gets lucky. If you measure efficiency on a single list, then that list might be brilliant for bubble sort, but not good for an insertion sort. How do you measure how good a sort algorithm is? What datasets would you use?
28th Apr 2018, 1:56 AM
Emma
+ 3
No true dataset is random. If you are sorting ISBN numbers, then you know something about the data.
28th Apr 2018, 9:36 AM
Emma
0
what if it is a random data set ? what if i have to pick an algorithm without knowing the type of the data set , what would apparently work better for all cases ?
28th Apr 2018, 9:25 AM
Nieb Hasan
Nieb Hasan - avatar
- 3
C++
28th Apr 2018, 4:58 AM
Ashok Gudala
Ashok Gudala - avatar