Yes, an algorithm is an implementation defined (imagine that you define a specific algorithm in the standard, and then someone comes in long and invents a more general one). You can find the standard yourself (just google clhs sort).
The implementation provided by sort and stable-sort , as a rule, should cover almost any sort you need. I can imagine the following reasons to write my own:
- You need interceptors at certain stages of the sorting procedure.
- You only need partial sorting
- You need a specific algorithm for your problem area.
- Do you want to compare different algorithms
In any case, I should recommend a deep study of existing sorting implementations so as not to miss possible optimizations (which usually matters in the context of sorting).
source share