Open chaozhiwen opened 5 years ago
private void sort(int[] nums,int lo,int hi){ if(lo>=hi) return; int i=lo,j=hi; while(i<j){ while(i<j&&nums[j]>=nums[lo]) j--; while(i<j&&nums[i]<=nums[lo]) i++; if(i<j) swap(nums,i,j); } swap(nums,lo,i); sort(nums,lo,i-1); sort(nums,i+1,hi); } private void swap(int[] nums,int i,int j){ int tmp=nums[i]; nums[i]=nums[j]; nums[j]=tmp; }