Esempio n. 1
0
 public void MergeSort_Test_1()
 {
     int[] nums     = { 8, 7, 6 };
     int[] expected = { 6, 7, 8 };
     int[] actual   = sortAlgos.MergeSort(nums);
     CollectionAssert.AreEqual(expected, actual);
 }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("---Sorting Algorithms---");
            var iArr = new int[] { 3, 2, 1, 9 };

            //SortAlgorithms.InsertionSort(iArr);
            iArr = new int[] { 3, 2, 1, 9, 47, 37 };
            //SortAlgorithms.QuickSort(iArr);

            //SortAlgorithms.HeapSort(iArr);

            var res = SortAlgorithms.MergeSort(iArr);
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            var test = new int[5] {
                5, 2, 1, 4, 3
            };

            SortAlgorithms <int> .MergeSort(test);

            foreach (var item in test)
            {
                Console.Write($"{item} ");
            }

            Console.ReadKey();
        }
 public void TestMergeSort()
 {
     originalList = new List <int>(new int[] { 5, 4, 3, 1, 2 });
     originalList = SortAlgorithms.MergeSort(originalList);
     CollectionAssert.AreEqual(sortedList, originalList);
 }