public static void MergeSort(int[] input, int low, int high) { if (low < high) { int middle = (low / 2) + (high / 2); MergeSort(input, low, middle); MergeSort(input, middle + 1, high); MergeSortAlgorithm.Merge(input, low, middle, high); } }
public void MergeSort() { int[] arr = { 31, 41, 59, 26, 41, 58 }; MergeSortAlgorithm.Merge(arr, 0, arr.Length); CollectionAssert.AreEqual(arr, new int[] { 26, 31, 41, 41, 58, 59 }); }