Esempio n. 1
0
        static void Main(string[] args)
        {
            ArrayGenerator arrayGenerator = new ArrayGenerator();
            InsertSort     insertSort     = new InsertSort();

            int[] insertSortMas = arrayGenerator.Generate(10);

            Console.WriteLine("\nBefore:");
            foreach (var item in insertSortMas)
            {
                Console.Write(item + " ");
            }

            Console.WriteLine("\n--- Insert Sort ---");
            insertSortMas = insertSort.Sort(insertSortMas);

            Console.WriteLine("After:");
            foreach (var item in insertSortMas)
            {
                Console.Write(item + " ");
            }

            QuickSort quickSort = new QuickSort();

            int[] quickSortMas = arrayGenerator.Generate(10);

            Console.WriteLine("\n\nBefore:");
            foreach (var item in quickSortMas)
            {
                Console.Write(item + " ");
            }

            int[] quickSorted = quickSort.Sort(quickSortMas);

            Console.WriteLine("\n--- Quick Sort ---");
            Console.WriteLine("After:");
            foreach (var item in quickSorted)
            {
                Console.Write(item + " ");
            }

            Console.ReadLine();
        }
Esempio n. 2
0
        private void GenerateBtn_Click(object sender, EventArgs e)
        {
            _generatedArray = ArrayGenerator.Generate();

            try
            {
                var arrString = _generatedArray.ToText();
                genArrayBox.Text = arrString;
                sortBtn.Enabled  = true;
            }
            catch (Exception ex)
            {
                genArrayBox.Text = ex.Message;
            }
        }
Esempio n. 3
0
        private void GenerateBtn_Click(object sender, EventArgs e)
        {
            _generatedArray = ArrayGenerator.Generate();
            var genPanels = new BlocksGeneration(VisualPanel.Height, VisualPanel.Width);

            try
            {
                var arrString = _generatedArray.ToText();
                genArrayBox.Text = arrString;
                _panels          = genPanels.Generate(_generatedArray);
                PaintPanels();
                sortBtn.Enabled = true;
            }
            catch (Exception ex)
            {
                genArrayBox.Text = ex.Message;
            }
        }