package algs.princeton; public class MergeSort { int[] Arr; int countMerge; //constructor MergeSort(int[] A){ this.Arr=A; this.countMerge=0; } public void divide(int[] A, int low, int high){ if(low==high) return; else{ this.countMerge++; int mid=(low+high)/2; divide(A, low, mid); divide(A, mid+1, high); mergeAndSort(A, low, mid, high); } } private static void mergeAndSort(int A[], int low, int mid, int high){ int m=mid-low+1;//num of elements in the first half of Array A int n=high-(mid+1)+1; //num of elements in the second half of Array A int[] firstHalf=new int [m]; int[] secondHalf=new int [n]; //extract the first half of already sorted sub array for (int i=0; i=m){ A[low++]=secondHalf[j++]; continue; } if(j>=n){ A[low++]=firstHalf[i++]; continue; } if(firstHalf[i]