Copilot试用 发表于 2022-06-03 阅读次数: 纪念一下第一个由Copilot完成的快速排序其中只输入了//quickSort和//partition 1234567891011121314151617181920212223class solution(){ //quickSort public static void quickSort(int[] arr, int left, int right){ if(left < right){ int pivot = partition(arr, left, right); quickSort(arr, left, pivot-1); quickSort(arr, pivot+1, right); } } //patition public static int partition(int[] arr, int left, int right){ int pivot = arr[right]; int i = left-1; for(int j = left; j < right; j++){ if(arr[j] <= pivot){ i++; swap(arr, i, j); } } swap(arr, i+1, right); return i+1; }}