Basically we have worst case in quick sort when all elements are same or sorted. If they are all same then we can't find the (n/4)th smallest element in it.
But if the value are 1 2 3 4 5.
We take pivot 1 here. Then 2, 3, 4, and 5.
So, no of comparison is n-1 + n-2 + ... + 1.
So n^2 is complexity for worst case which is sorted