Пример #1
0
        static void Main(string[] args)
        {
            var mergeSort = new MergeSort(GenerateArray(100000));

            mergeSort.Execute();

            var insertionSort = new InsertionSort(GenerateArray(100000));

            insertionSort.Execute();

            var selectionSort = new SelectionSort(GenerateArray(100000));

            selectionSort.Execute();

            var bubbleSort = new BubbleSort(GenerateArray(100000));

            bubbleSort.Execute();

            var quickSort = new QuickSort(GenerateArray(100000));

            quickSort.Execute();

            var dotnetSort = new DotnetLibrarySort(GenerateArray(100000));

            dotnetSort.Execute();

            var shellSort = new ShellSort(GenerateArray(100000));

            shellSort.Execute();
        }
Пример #2
0
        static void Main(string[] args)
        {
            // 插入排序
            int[] arr = Utils.GenRandomArray(10);
            Utils.WriteBefore(nameof(InsertionSort), arr);
            InsertionSort.Execute(arr);
            Utils.WriteAfter(nameof(InsertionSort), arr);

            // 冒泡排序
            arr = Utils.GenRandomArray(10);
            Utils.WriteBefore(nameof(BubbleSort), arr);
            BubbleSort.Execute(arr);
            Utils.WriteAfter(nameof(BubbleSort), arr);

            // 选择排序
            arr = Utils.GenRandomArray(10);
            Utils.WriteBefore(nameof(SelectionSort), arr);
            SelectionSort.Execute(arr);
            Utils.WriteAfter(nameof(SelectionSort), arr);

            Console.ReadLine();
        }