예제 #1
0
        static void Main()
        {
            int[] arrayForMergeSort = { 122, 352, 182, 3, 6, 4, 215, 10, 87, 14 };
            MergeSortArray sortedArray = new MergeSortArray();
            sortedArray.MergeSort(arrayForMergeSort, 0, arrayForMergeSort.Length - 1);

            foreach (var item in arrayForMergeSort)
            {
                Console.WriteLine(item);
            }
        }
예제 #2
0
        // Main driver function
        static void Main(string[] args)
        {
            int[] arr = { 5, 9, 2, 3, 6, 4, 11, 10, 8, 14 }; // this is the array to be sorted

            MergeSortArray merge = new MergeSortArray();

            // Calling Merge Procedure
            merge.mergesort(arr, 0, arr.Length - 1);

            // Printing Sorted array. after merge sort
            foreach (int a in arr)
            {
                Console.Write(a + " ");
            }
        }