private static <T extends Comparable<T>> int partition(T[] a, int lo, int hi) {
	  int i = lo, j = hi+1; //Left and right scan indices
	  T v = a[lo];
	  while (true) {
		  while (less(a[++i], v)) 
			  if (i == hi) break;
		  while (less(v, a[--j]))
			  if (j == lo) break;
		  if (i >= j) break;
		  exch(a, i, j);
	  }
	  exch(a, lo, j);
	  return j;
  }