“The basis for most other math and physics” they do a complete fucksewage job at demonstrating that in school. I remember several years in math class “And here’s the quadratic equation, the one that’s all over 2a” and it was an exercise in plugging and chugging.
Math is a useful, powerful and allegedly beautiful thing. it’s such a shame it’s illegal to teach it competently.
If I’m not mistaken, quick sort is worst case O(n^2), merge sort is what actually achieves O(nlogn), the point is that quicksort is on average more memory (and time?) efficient
When using a random pivot, the worst case becomes exponentially more unlikely the larger the n. The O notation only cares about the complexity when n approaches infinity. So when n approaches infinity, the likelihood of O(n^2) performance approaches 0 (and the likelihood of O(n log n) approaches 1).
The quadratic equation is the basis for most other math and physics. It’s used all the time.
The good thing about quicksort is that it’s a good demonstration of an O(n log n) algorithm, and that’s about it.
“The basis for most other math and physics” they do a complete fucksewage job at demonstrating that in school. I remember several years in math class “And here’s the quadratic equation, the one that’s all over 2a” and it was an exercise in plugging and chugging.
Math is a useful, powerful and allegedly beautiful thing. it’s such a shame it’s illegal to teach it competently.
If I’m not mistaken, quick sort is worst case O(n^2), merge sort is what actually achieves O(nlogn), the point is that quicksort is on average more memory (and time?) efficient
Maybe.
When using a random pivot, the worst case becomes exponentially more unlikely the larger the n. The O notation only cares about the complexity when n approaches infinity. So when n approaches infinity, the likelihood of O(n^2) performance approaches 0 (and the likelihood of O(n log n) approaches 1).
I think it’s fine to call it O(n log n).
That’s when you add a w.h.p. (with high probability)