From various sources cited I know that in-built C function, stable_sort is stable but qsort is unstable. If that is the case why do we use qsort at all? Isn't it redundant? Why not use stable_sort instead?
A stable sort means that the order of equal elements is preserved. This is not always required.
If it is not required, the algorithm is simpler, and sometimes faster and/or more memory-efficient.
A typical example of a stable sort algorithm is merge sort.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With