int partition (int A[], int p, int r) { int x = A[p]; int i = p-1; int j = r+1; int temp; while (1) { while (A[--j] > x); while (A[++i] < x); if ( i