Exemple #1
0
 static void Main(string[] args)
 {
     int[] arr = new int[] { 1, 7, 9, 3, 5, 6, 4, 8 };
     MergeSortAlgorithm.MergeSort(arr, 0, arr.Length - 1);
     foreach (int x in arr)
     {
         Console.WriteLine(x);
     }
     Console.ReadLine();
 }
Exemple #2
0
        static void Main(string[] args)
        {
            int numberOfDataSets = Convert.ToInt32(Console.ReadLine());

            for (int i = 0; i < numberOfDataSets; i++)
            {
                int      itemsInDataSet = Convert.ToInt32(Console.ReadLine());
                string[] dataAsString   = Console.ReadLine().Split(' ');
                int[]    dataAsInt      = Array.ConvertAll(dataAsString, Int32.Parse);
                Console.WriteLine(MergeSortAlgorithm.MergeSort(dataAsInt).ToString());
                Console.WriteLine(MergeSortAlgorithm.PrintArray(dataAsInt));
            }
        }