Ejemplo n.º 1
0
        // Gets the sort that the user selects
        private void GetSortSelection()
        {
            string sort = GetComboBoxItem();

            if (Delay_textBox.Text.Equals(""))
            {
                Delay_textBox.Text = "10";
            }
            int delay = Convert.ToInt32(Delay_textBox.Text);

            switch (sort)
            {
            case SortingConstants.bubbleSort:
                SortAlgorithms.BubbleSort(values, delay);
                break;

            case SortingConstants.selectionSort:
                SortAlgorithms.SelectionSort(values, delay);
                break;

            case SortingConstants.insertionSort:
                SortAlgorithms.InsertionSort(values, delay);
                break;

            case SortingConstants.quickSort:
                SortAlgorithms.QuickSort(values, 0, values.Length - 1, delay);
                timeComplexity_label.Content = SortingConstants.bigOlogN;
                break;

            case SortingConstants.heapSort:
                SortAlgorithms.HeapSort(values, delay);
                timeComplexity_label.Content = SortingConstants.bigOlogN;
                break;

            default:
                break;
            }
        }