UNB/ CS/ David Bremner/ teaching/ java/ MyMergeSort2.java
public class MyMergeSort2 extends MyMergeSort {


    public static void sort(int[] a){

        if (a.length <= 1)
            return;

        if (a.length <= 26){
            SelectionSort.sort(a);
            return;
        }

        int mid=a.length/2;

        int[] left=new int[mid];
        int[] right=new int[a.length-mid];

        for (int i=0; i<mid; i++)
            left[i]=a[i];

        for (int i=0; i<right.length; i++)
            right[i]=a[mid+i];

        sort(left);
        sort(right);
        merge(left,right,a);

    }

}