Exemplo n.º 1
0
        public static void testSorting()
        {
            string[] strings = { "sort", "this", "words", "AAAA", "please", "friend" };
            InsertingSort <string> .InsertionSort(strings);

            foreach (var str in strings)
            {
                Console.Write(str + " ");
            }
            Console.WriteLine();
            int[] numbers = new[] { 3, 6, 1, -5, 0, 7, 23, 7, -27, -75, 2 };
            InsertingSort <int> .InsertionSort(numbers);

            foreach (var number in numbers)
            {
                Console.Write(number + " ");
            }
            Console.WriteLine();
        }
Exemplo n.º 2
0
        public static void TestSorting()
        {
            string[] strings = { "can", "governing", "factors", "horticulture", "botanist", "describe", "Any" };
            InsertingSort <string> .InsertionSort(strings);

            foreach (var str in strings)
            {
                Console.Write(str + " ");
            }
            Console.WriteLine();
            var numbers = new[] { 7, 34, 13, -34, 4, 86, 0, 34, 1, 56, -5 };

            InsertingSort <int> .InsertionSort(numbers);

            foreach (var number in numbers)
            {
                Console.Write(number + " ");
            }
            Console.Write("\nTestSorting completed\n\n");
        }