3 ms·
Adding to what mooism said, there is a general "consensus" of sorts as to which sorting algorithm is "best". "Best" in this case would be fast enough for most g
by chewxy 13y ago
Adding to what mooism said, there is a general "consensus" of sorts as to which sorting algorithm is "best". "Best" in this case would be fast enough for most general purpose computing.
The answer is: Timsort. It's a combination of mergesort and some kind of insertion sort. It's currently used in the default sorting libs of Java, Python, Android, Octave.. blabla.
But there WILL come a time where you need to write your own sorting algo(or use a different algo from a different lib). This is where you need to know your sorting algos and their times/memories tradeoff