Partition algorithm
B[h..k] contains at least 2 elements. Using the name x for the original
value in b[h], permute b[h..k] so that it looks as below and return j
public int partition (int [ ] b, int h, int k ) {
else if (b[j] > x) j= j-1;
else {//Swap b[i] and b[j]
int t= b[i]; b[i]= b[j]; b[j]= t;}
int s= b[i]; b[i]= b[j]; b[j]= s;