correct the sort

use pivot=A[(i+j)/2] instead of A[(i+j)/2]. Because the pivot is moving
too. not sure whether the left  part of pivot is of the same number of
the right part