Consider an array A:
n=5
We apply partition function as partition(A, 5).
'3' is the pivot element.
So after partition function, we have:
So, Left_End=2 i.e. number of element on the left side of '3'. Exclude 3 from the count.
Now suppose k=2
Left_End+1=3 ( !=2)
Now, k<Left_End+1
Now, 2nd smallest element should be the the 2nd element of the left subarray of 3 if it was sorted.
So 'k' remains 2, size of the subarray=2 and array starts from A.
So first statement will be:
(A,2,2): (a, Left_End, k)
Now, if k=4
Left_End+=3 (!=4)
Now, k>Left_End+1
So, 4th smallest element would be the first element of right subarray if it was sorted.
So 'k' becomes 1, size of the array=2 and we start from index=3 ( a+3 )
So second statement will be
(A+3, 2, 1): ( a+left_end+1, n-(left_end+1), k-(left_end+1))
Hence, option A would be thr right answer.