In practice there is basically only one algorithm used, and that would be the Tim sort. It’s the go to if you’re writing in a high level language.
In languages closer to the hardware with less abstraction you can sometimes use something else. But every algorithm is a bit different.
For example quick sort uses less memory than Tim sort, but the advantage of Tim sort is that if you give it already sorted numbers to sort (or almost sorted), it’s gonna take way less time to do so than if you gave it an unsorted array of numbers. Unlike with quick sort.
… and there are others with other caveats
But the answer to the question why do so many get taught is that it really does teach how to write all sorts of other algorithms and ace that LeetCode problem.
Latest Answers