modifing the partition routine for quicksort