Esempio n. 1
0
        private void RandomButton_Click(object sender, EventArgs e)
        {
            NewMasTextBox.Clear();
            TimerSec.Clear();
            Random rnd  = new Random();
            int    n    = rnd.Next(1, 1000);
            string line = null;

            for (int i = 0; i < n - 1; i++)
            {
                line += rnd.Next(-100000, 100000);
                if (i % 8 == 0 && i != 0)
                {
                    line += '\n';
                }
                else
                {
                    line += " ";
                }
            }
            line += rnd.Next(-10000, 10000);
            MainMasTextBox.Text = line;
        }
Esempio n. 2
0
        private void Sort_Click(object sender, EventArgs e)
        {
            NewMasTextBox.Clear();
            Stopwatch time = new Stopwatch();

            long[] array = HeapSort.Sort.arrayReadText(MainMasTextBox.Text);
            time.Start();
            HeapSort.Sort.heapSort(ref array);
            time.Stop();
            string temp = HeapSort.Sort.outputArray(ref array);

            algoTime = time.Elapsed.Ticks.ToString();
            int n = HeapSort.Count.size;

            NewMasTextBox.Text         += "================================\n";
            NewMasTextBox.Text         += "Теоретическое время работы: " + Math.Ceiling(n * Math.Log(n, 2)) + "\n";
            NewMasTextBox.Text         += "Практическое время работы: " + algoTime + "\n";
            NewMasTextBox.Text         += "Кол-во элементов: " + n + "\n";
            NewMasTextBox.Text         += "================================\n";
            NewMasTextBox.Text         += temp;
            NewMasTextBox.Text         += '\n';
            TimerSec.SelectionAlignment = HorizontalAlignment.Center;
            TimerSec.Text = algoTime;
        }
Esempio n. 3
0
 private void Clear_Click(object sender, EventArgs e)
 {
     MainMasTextBox.Clear();
     NewMasTextBox.Clear();
     TimerSec.Clear();
 }