3 ms·
You're right in a way, but I was surprised by how even the worst algorithms you learn in school have some properties that are better than the ones considered th
by jere 13y ago
You're right in a way, but I was surprised by how even the worst algorithms you learn in school have some properties that are better than the ones considered the best (e.g. bubble vs quicksort, quicksort isn't stable). This website makes it pretty clear: http://www.sorting-algorithms.com/ http://www.sorting-algorithms.com/
To the larger point: everything is a tradeoff once we refuse to consider the "stupid solutions." Yea, bogosort is absolutely stupid, but we don't really think about it when seriously designing software. Instead, we're left with the smart solutions, none of which can be considered optimal for all applications.
Everything is a tradeoff is a tautology. Because if one algorithm was proven to completely dominate another algorithm, we would no longer seriously consider the weak algorithm.
- lucian1900 13y agoIt's pretty easy to make quicksort stable. The more interesting comparison is with insertion sort, which is often used for small arrays.