private static int merge(Comparable[] a, Comparable[] 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;

		// number of array access
		int numAccess = 0;

		// Copy a[lo..hi] to aux[lo..hi]. 2 access per copy
		for (int k = lo; k <= hi; k++, numAccess += 2)
			aux[k] = a[k];

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