示例#1
0
        static void Main(string[] args)
        {
            BubbleSort<string> bsStr = new BubbleSort<string>();
            string[] strArr = { "c", "b", "a", "d", "f", "z" };
            bsStr.BubbleSortFunction(strArr);

            BubbleSort<int> bsInt = new BubbleSort<int>();
            int[] intArr = new int[] { 1, 9, 5, 8, 2, 7 };
            bsInt.BubbleSortFunction(intArr);

            Console.WriteLine("Success!");
            Console.ReadLine();
        }
示例#2
0
        static void Main(string[] args)
        {
            const int numCount = 10000;
            const int min = 0, max = 10000;

            var insertSorter = new InsertionSort(numCount, min, max);

            insertSorter.Insertion();
            Console.WriteLine(insertSorter.ToString());


            var bubbleSorter = new BubbleSort.BubbleSort(numCount, min, max);

            bubbleSorter.Bubble();
            Console.WriteLine(bubbleSorter.ToString());
        }
示例#3
0
        static void Main(string[] args)
        {
            const int numCount = 100000;
            const int min = 0, max = 100000;

            var mergeSort = new MergeSort(numCount, min, max);

            mergeSort.Merge();
            Console.WriteLine(mergeSort.ToString());


            var bubbleSorter = new BubbleSort.BubbleSort(numCount, min, max);

            bubbleSorter.Bubble();
            Console.WriteLine(bubbleSorter.ToString());

            var tempnums = new int[numCount];

            for (int i = 0; i < numCount; i++)
            {
                tempnums[i] = new Random().Next(min, max);
            }
        }