private void mergeIndirect(T[] a, int[] perm, int[] aux,
			int lo, int mid, int hi)
	{
		// i and j is used to point to the currently processing element in the
		// first and 2nd half respectively
		int i = lo, j = mid + 1;

		// Copy perm[lo..hi] to aux[lo..hi].
		for (int k = lo; k <= hi; k++)
			aux[k] = perm[k];

		// Merge back to perm[lo..hi].
		for (int k = lo; k <= hi; k++)
			if (i > mid) // 1st half is exhausted.
				perm[k] = aux[j++];
			else if (j > hi) // 2st half is exhausted.
				perm[k] = aux[i++];
			else if (SortHelper.less(a[aux[j]], a[aux[i]]))
				perm[k] = aux[j++];
			else
				perm[k] = aux[i++];
	}