class Solution {
public int[] sortArray(int[] nums) {
nums=quicksort(nums,0,nums.length-1);
return nums;
}
public int[] quicksort(int[] nums,int l,int r)
{
int i=l;
int j=r;
if(i>=j)
{
return nums;
}
int k=0;
int p=nums[l];
while(i[HTML_REMOVED]=p&&i<j)
{
j–;
}
while(nums[i]<=p&&i<j)
{
i++;
}
k=nums[i];
nums[i]=nums[j];
nums[j]=k;
}
nums[l]=nums[i];
nums[i]=p;
quicksort(nums,l,j-1);
quicksort(nums,j+1,r);
return nums;
}
}
j–上面复制出来有问腿,代码看下面
nums[j]>=p&&i<j