NOTE: Assuming desired sort is ascending order, Choosing last element as pivot always.
i am getting S1 > S2 , see how
PARTITION(A,p,r)
1 x = A[r]
2 i = p - 1
3 for j = p to r - 1
4 if A[j] <= x
5 i = i +1
6 exchange A[i] with A[ j ]
7 exchange A[i + 1] with A[r]
8 return i + 1
If I am Wrong please let me know.