6. (20 pts) The following is a variant of Partition, in which we use A[p] as the pivot and scan the array from index p + 1 to r. Question: Fill in the four blanks so that the modified Partition will work correctly. (If you think it is impossible to do partition in this way, then say so and explain why.)
Partition(A, p, r)
x < A[p]
// choose A[p] as the pivot//
i = p + 1
// initialize i//
for j <- p + 1 to r
// scan A[p + 1..r]//
if A[j] < x
i = i + 1
exchange A[i] with A[j]
exchange A[p] with A[i]
return i