public static void main(String[] args) {
int arr[] = {43,23,54,12,9,44};
quickSort(arr, 0, 5);
print(arr);
}public static void quickSort(int[] arr,int left, int right){ int i = left; int j = right; int key = arr[left]; if(left >= right){ return; } while(i<j){ while(i<j && arr[j]>=key){ j--; } while(i<j && arr[i]<=key){ i++; } if(i<j){ swap(arr, i, j); } } arr[left]=arr[i]; arr[i]=key; quickSort(arr,left,i-1); quickSort(arr,i+1,right); }为什么出现异常java.lang.ArrayIndexOutOfBoundsException: 6
添加回答
举报
0/150
提交
取消