Exemplo n.º 1
0
        static void Main(string[] args)
        {
            int[] Arr = new int[] { 1, 100, 45, 62, 3, 2, 1000 };

            //Merge Sort
            Merge_Sort mergeobj = new Merge_Sort();

            mergeobj.MergeSort(Arr);
            Console.WriteLine("Sorting using Merge Sort Method");
            mergeobj.Print(Arr);

            //Counting Sort
            Console.WriteLine("Sorting using Counting Sort Method");
            CountingSort obj = new CountingSort();

            obj.Counting_Sort(Arr, 10001);

            //Heap Sort
            Console.WriteLine("Sorting using Heap Sort Method");
            HeapSort heap = new HeapSort();

            heap.Heap_Sort(Arr);

            Console.ReadKey();
        }
Exemplo n.º 2
0
        // there is another implementation of counting sort that caters for negative numbers in problems
        private static void SolveWithCountingSort()
        {
            string test = "0 0 2 9 4 5 2 4 9 8 3 1 0";

            int[] testCase = GetTest(test, 13);
            Display(testCase);

            ISort sort = new CountingSort();

            int[] result = sort.Sort(testCase);
            Display(result);
        }