예제 #1
0
        static void Main(string[] args)
        {
            int[] array01 = { 5, 1, 3, 10, 20, 4, 16 };
            int[] array02 = { 5, 1, 3, 10, 20, 4, 16 };

            ArraySort.BubbleSort(ref array01);
            foreach (int elem in array01)
            {
                Console.Write(elem + " ");
            }

            Console.WriteLine();

            ArraySort.SelectionSort(ref array02);
            foreach (int elem in array02)
            {
                Console.Write(elem + " ");
            }

            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            int[] array1 = { 3, 5, -34, 0, 76 };
            ArraySort.BubbleSort(array1);
            Console.Write("Bubble: ");
            foreach (var i in array1)
            {
                Console.Write(i + " ");
            }

            Console.WriteLine("\n");

            int[] array2 = { 3, 5, -34, 0, 76 };
            ArraySort.SelectSort(array2);
            Console.Write("Select: ");
            foreach (var i in array2)
            {
                Console.Write(i + " ");
            }

            Console.ReadKey();
        }
예제 #3
0
        static void Main(string[] args)
        {
            List <int> array = new List <int> {
                -15, 34, -26, 20, -12, 0, 14, 88, 0
            };

            ArraySort.BubbleSort(array);
            Console.WriteLine("После сортировки: ");
            for (int i = 0; i < array.Count; i++)
            {
                Console.Write($"{array[i]} ");
            }

            Console.WriteLine();

            ArraySort.SelectionSort(array);
            for (int i = 0; i < array.Count; i++)
            {
                Console.Write($"{array[i]} ");
            }

            Console.ReadKey();
        }