hw2: partition
impled partition in hw2
pick last element of subarray as pivot