using middle as pivot in quicksort