We know that quick sort will give best time complexity when partition will divide there array in two equal parts every time.ie, when every time pivot element selected will be the median of the array(sorted).
NOTE:- BUT FOR THAT WE HAVE TO PRIOR ONLY KNOW ABOUT THE ELEMENTS WHICH IS NOT ALWAYS POSSIBLE.
THEREFORE, of that will happen then:-T(n) equals 2T(n/2) + (n+1). Which is like the merge sort therefore time complexity equals. N log N.
Note:-in this question this concept does not required to be applied so as such😁
But here in this question we know about the elements. So if we select the median element 1st time then after the 1st iteration only the elements will be sorted.
Therefore, probability equals (n/3) by n ,equals 1/3.