I think people confuse the Quicksort partition-based sorting algorithm and the "qsort" various library implementations.
I prefer the Quicksort algorithm to use a selectable selection algorithm, which is very important for analyzing its behavior.
If the first item is always selected as the reference item, then an already sorted list is the worst. Often there is a high probability that the array is already / almost sorted, so this implementation is pretty bad.
Similarly, choosing the last element as the rotation axis is bad for the same reason.
Some implementations try to avoid this problem by choosing the middle element as the fulcrum. This did not affect the already / almost sorted arrays so much, but you could still construct an input that will use this predictable choice of rotation and make it work in quadratic time.
Thus, you get randomized algorithms for selecting control points, but even this does not guarantee O(N log N) .
So, other algorithms were developed that would use some information from the sequence before collecting the rod. You can, of course, scan the entire sequence and find the median and use it as a rod. This guarantees O(N log N) , but, of course, slower in practice.
So, some angles were cut off, and people developed the median 3 algorithm. Of course, later even this was available by the so-called median of 3 killers.
Thus, additional attempts are made to develop more “intelligent” control points selection algorithms that guarantee the asymptotic behavior of O(N log N) , which is still fast enough to be practical with varying degrees of success.
So, unless a specific implementation of Quicksort is specified, the question of when the worst case scenario occurs is undefined. If you use the so-called reference median selection algorithm, there is no quadratic worst case scenario.
However, most library implementations are likely to lose the O(N log N) guarantee for faster sorting in the middle case. Some of the really old implementations use the first element as a core, which is now well understood as poor and is no longer a widely used practice.