private static int partition(Comparable[] a, int lo, int hi)
	{ // Partition into a[lo..i-1], a[i], a[i+1..hi].
		int i = lo, j = hi + 1; // left and right scan indices
		Comparable v = a[lo]; // partitioning item
		while (true)
		{ // Scan right, scan left, check for scan complete, and exchange.
			while (SortHelper.less(a[++i], v))
			{
				numCmp++;
				if (i == hi)
					break;
			}
			while (SortHelper.less(v, a[--j]))
			{
				numCmp++;
				if (j == lo)
					break;
			}
			if (i >= j)
				break;
			SortHelper.exch(a, i, j);
		}
		SortHelper.exch(a, lo, j); // Put v = a[j] into position
		return j; // with a[lo..j-1] <= a[j] <= a[j+1..hi].
	}