/*
 public class SelSort {

        public void selSort(int a[], int start) {
                if (start < a.length - 1) {
                        int smallestIndex = indexOfSmallest(a, start);

                        int temp = a[start];
                        a[start] = a[smallestIndex];
                        a[smallestIndex] = temp;

                        selSort(a, start + 1);
                }
        }



        // Return the smallest element at index start or higher
        private int indexOfSmallest(int a[], int start) {
                int smallestIndex = start;
                for (int i = start + 1; i < a.length; i++) {
                        if (a[i] < a[smallestIndex]) {
                                smallestIndex = i;
                        }
                }
                return smallestIndex;
        }
}

















class MergeSort {

        public void sort(int[] array) {
                mergeSort(array, 0, array.length - 1);
        }
        
        
        
        
        

        public void mergeSort(int[] array, int left, int right) {
                if (left < right) {
                        int middle = (right + left) / 2;
                        mergeSort(array, left, middle);
                        mergeSort(array, middle + 1, right);
                        merge(array, left, middle, right);
                }
        }








        private void merge(int[] array, int left, int middle, int right) {
                // create tempArray for use in merging
                int[] tempArray = new int[array.length];

                // Copy both pieces into tempArray.
                for (int i = left; i <= right; i++) {
                        tempArray[i] = array[i];
                }

                int indexLeft = left;
                int indexRight = middle + 1;
                int target = left;

                // Merge them together back in array while there are
                // elements left in both halves.
                while (indexLeft <= middle && indexRight <= right) {
                        if (tempArray[indexLeft] < tempArray[indexRight]) {
                                array[target] = tempArray[indexLeft];
                                indexLeft++;
                        } else {
                                array[target] = tempArray[indexRight];
                                indexRight++;
                        }
                        target++;
                }

                // Move any remaining elements from the left half.
                while (indexLeft <= middle) {
                        array[target] = tempArray[indexLeft];
                        indexLeft++;
                        target++;
                }

                // Move any remaining elements from the right half.
                while (indexRight <= right) {
                        array[target] = tempArray[indexRight];
                        indexRight++;
                        target++;
                }
        }
}
*/
