Beispiel #1
0
        public static bool QuickSortDescending(int[] numbers, int size)
        {
            int MinRange = 0;
            int MaxRange = 100;

            numbers = ArrayGenerator.Generate(size, MinRange, MaxRange, ArraySort.Descending);
            QuicksortImplementing(numbers, 0, numbers.Length - 1);
            return(true);
        }
Beispiel #2
0
        public static bool bubble_sort_V_shape(int[] array, int size)
        {
            int temp     = 0;
            int MinRange = 0;
            int MaxRange = 100;

            array = ArrayGenerator.Generate(size, MinRange, MaxRange, ArraySort.VShape);

            for (int i = 0; i < array.Length; i++)
            {
                for (int sort = 0; sort < array.Length - 1; sort++)
                {
                    if (array[sort] > array[sort + 1])
                    {
                        temp            = array[sort + 1];
                        array[sort + 1] = array[sort];
                        array[sort]     = temp;
                    }
                }
            }
            return(true);
        }
Beispiel #3
0
 public static bool QuickSortWithRandom(int[] numbers, int size)
 {
     numbers = ArrayGenerator.GenerateRandomArray(size);
     return(true);
 }
Beispiel #4
0
        static void RunAnalysis(int size)
        {
            int[]     randomArray = ArrayGenerator.GenerateRandomArray(size);
            Stopwatch stopWatch   = new Stopwatch();

            #region BubbleSort_random
            //stopWatch.Start();
            //bool IndexofBubbleSort = SimpleSorting.bubble_sortWithRandomArray(randomArray);
            //stopWatch.Stop();
            //long TimeBubblesort = stopWatch.ElapsedMilliseconds;
            #endregion

            #region BubbleSort_V_shaped

            //stopWatch.Reset();

            //stopWatch.Start();
            //bool IndexofBubbleSortVShaped = SimpleSorting.bubble_sort_V_shape(randomArray,size);
            //stopWatch.Stop();
            //long TimeBubblesortVShaped= stopWatch.ElapsedMilliseconds;
            #endregion

            #region BubbleSort_A_shaped

            //stopWatch.Reset();

            //stopWatch.Start();
            //bool IndexofBubbleSortAShaped = SimpleSorting.bubble_sort_V_shape(randomArray, size);
            //stopWatch.Stop();
            //long TimeBubblesortAShaped = stopWatch.ElapsedMilliseconds;

            //Console.WriteLine(TimeBubblesortAShaped);

            #endregion

            #region BubbleSort_ascending

            //stopWatch.Reset();

            //stopWatch.Start();
            //bool IndexofBubbleSortAscending= SimpleSorting.bubble_sort_ascending(randomArray, size);
            //stopWatch.Stop();
            //long TimeBubblesortAscending = stopWatch.ElapsedMilliseconds;
            ////Console.WriteLine(TimeBubblesortAscending);

            #endregion

            #region BubbleSort_descending

            //stopWatch.Reset();

            //stopWatch.Start();
            //bool IndexofBubbleSortDescending = SimpleSorting.bubble_sort_descending(randomArray, size);
            //stopWatch.Stop();
            //long TimeBubblesortDescending = stopWatch.ElapsedMilliseconds;
            //Console.WriteLine(TimeBubblesortDescending);

            #endregion

            #region RandomQuickSort
            stopWatch.Reset();

            stopWatch.Start();
            //bool indexofQuickSort = AdvancedSorting.QuickSortWithRandom(randomArray,size);
            //stopWatch.Stop();
            //long TimeQuickSort = stopWatch.ElapsedMilliseconds;
            //Console.WriteLine(TimeQuickSort);

            #endregion

            #region QuickSort_V_shape
            //stopWatch.Reset();

            //stopWatch.Start();
            //bool indexofQuickSortVShape = AdvancedSorting.QuickSortVshape(randomArray, size);
            //stopWatch.Stop();
            //long TimeQuickSortVShape = stopWatch.ElapsedMilliseconds;
            //Console.WriteLine(TimeQuickSortVShape);


            #endregion

            #region QuickSort_A_shape
            //stopWatch.Reset();

            //stopWatch.Start();
            //bool indexofQuickSortAShape = AdvancedSorting.QuickSortVshape(randomArray, size);
            //stopWatch.Stop();
            //long TimeQuickSortAShape = stopWatch.ElapsedMilliseconds;
            //Console.WriteLine(TimeQuickSortVShape);


            #endregion

            #region QuickSort_ascending
            // stopWatch.Reset();

            //stopWatch.Start();
            //bool indexofQuickSortAscending = AdvancedSorting.QuickSortVshape(randomArray, size);
            //stopWatch.Stop();
            //long TimeQuickSortAscending = stopWatch.ElapsedMilliseconds;
            //Console.WriteLine(TimeQuickSortAscending);

            #endregion

            #region QuickSort_Descending
            //stopWatch.Reset();

            //stopWatch.Start();
            //bool indexofQuickSortDescending = AdvancedSorting.QuickSortVshape(randomArray, size);
            //stopWatch.Stop();
            //long TimeQuickSortDescending= stopWatch.ElapsedMilliseconds;
            //Console.WriteLine(TimeQuickSortDescending);

            #endregion

            CountingSorting.CountingSort(randomArray);
        }