4 ms·
Because it is available in almost every standard library? In most cases developers don't care for the worst case because they either have no idea what you are
by lmilcin 7y ago
Because it is available in almost every standard library?
In most cases developers don't care for the worst case because they either have no idea what you are talking about or, if they actually understand the problem, they try to ensure they don't need to sort arbitrary amount of user-controllable data.
- deleted 7y ago[deleted]
- tyingq 7y agoLibc qsort() isn't quicksort in several of the popular libc implementations. For example, it's (usually) a merge sort in glibc. http://calmerthanyouare.org/2013/05/31/qsort-shootout.html http://calmerthanyouare.org/2013/05/31/qsort-shootout.html
- ape4 7y agoInteresting. The man page just says "sort an array". https://linux.die.net/man/3/qsort https://linux.die.net/man/3/qsort
- mark-r 7y agoExactly. As long as you get the proper results within reasonable time and memory constraints, why should you care exactly which algorithm is used?
- marmada 7y agoMaybe it's interesting to know what qsort does under the hood? Maybe you don't know what qsort's time and memory constraints are unless you know the underlying algorithim. Obviously the sorting algorithim you use matters, so this post has some theoretical value.
- mark-r 7y agoCertainly it matters, but I'd expect a library implementation to have more research applied to it than I can do on my own.