Beispiel #1
0
        private void ButtonStartSort_Click(object sender, EventArgs e)
        {
            bubbleSort BS = new bubbleSort();

            BS.bs_progressBar += changeProgressBarBubble;
            BS.bs_finished    += bs_finished;
            Thread threadBubble = new Thread(() => BS.startSorting(unsortedArray));

            shellSort SS = new shellSort();

            SS.ss_progressBar += changeProgressBarShell;
            SS.ss_finished    += ss_finished;
            Thread threadShell = new Thread(() => SS.startSorting(unsortedArray));

            quickSort QS = new quickSort();

            QS.qs_progressBar += changeProgressBarQuick;
            QS.qs_finished    += qs_finished;
            Thread threadQuick = new Thread(() => QS.startSorting(unsortedArray));

            threadShell.Start();
            threadBubble.Start();
            threadQuick.Start();

            //Thread threadBubbleSort = new Thread(new ParameterizedThreadStart(bubbleSort));
            //Thread threadShellSort = new Thread(new ParameterizedThreadStart(shellSort));
            //Thread threadQuickSort = new Thread(new ParameterizedThreadStart(quickSort));
            //threadBubbleSort.Start(unsortedArray);
            //threadShellSort.Start(unsortedArray);
            //threadQuickSort.Start(unsortedArray);
        }
Beispiel #2
0
        private void shellSort(object unsortedArray)
        {
            var Sort = new shellSort();

            Sort.startSorting((int[])unsortedArray);
            labelShellSort.Text = "Shell sort:" +
                                  System.Environment.NewLine +
                                  "Iterations: " + Sort.countIteration +
                                  System.Environment.NewLine +
                                  "Changes: " + Sort.countChanges +
                                  System.Environment.NewLine +
                                  "Total ticks: " + Sort.stopWatch.ElapsedTicks;
        }