-2
我需要幫助這個代碼寫入僞編寫代碼爲僞
public void quickSort(int[] A, int p, int r) {
if (p < r) {
int q = partition(A, p, r);
quickSort(A, p, q);
quickSort(A, q + 1, r);
}
}
private int partition(int[] A, int p, int r) {
int x = A[p]; // pivot element x
int i = p - 1;
int j = r + 1;
// partition
while (true) {
do {
j--;
} while (A[j] > x);
do {
i++;
} while (A[i] < x);
if (i < j)
swap(A, i, j);
else
return j;
}
}
private void swap(int[] A, int i, int j) {
int tmp = A[i];
A[i] = A[j];
A[j] = tmp;
}}