I'm currently working on an analysis project where I'm observing how different algorithms behave when implemented in Java. I got some code which implements a Mergesort algorithm from online, now I need to run this code on an array of 10,000 randomly generated integers (between 1 and 100,000) and record how many swaps and comparisons were made. 

I'm not exactly sure at which point in the code to increment the variables that count Swaps and Comparisons. What would the expected value be? Since best, worst, and average case for Mergesort are all nlog(n) does this mean I should expect 10,000\*(log base 2 of 10,000) approx = 138,000 for the sum of swaps and comparisons?

Here is the code, I'm guessing that a swap only happens when the original array is altered, comparisons I'm not too sure about:

```
void MergeSort(int low, int high)
   // a[low : high] is a global array to be sorted.
// Small(P) is true if there is only one element to
// sort. In this case the list is already sorted.
{
   if (low < high) { // If there are more than one element
          // Divide P into subproblems.
          // Find where to split the set.
          int mid = (low + high)/2;
          // Solve the subproblems.
          MergeSort(low, mid);
          MergeSort(mid + 1, high);
          // Combine the solutions.
          Merge(low, mid, high);
   }
}

   void Merge(int low, int mid, int high)
 // a[low:high] is a global array containing two sorted
 // subsets in a[low:mid] and in a[mid+1:high]. The goal
 // is to merge these two sets into a single set residing
 // in a[low:high]. b[] is an auxiliary global array.
 {
     int h = low, i = low, j = mid+1, k;
   while ((h <= mid) && (j <= high)) {
      if (a[h] <= a[j]) { b[i] = a[h]; h++; }
      else { b[i] = a[j]; j++; } i++;
   }
   if (h > mid) for (k=j; k<=high; k++) {
                   b[i] = a[k]; i++;
                }
   else for (k=h; k<=mid; k++) {
           b[i] = a[k]; i++;
        }
   for (k=low; k<=high; k++) a[k] = b[k];

```

}