Пример #1
0
        private void Сорт_Click(object sender, EventArgs e)
        {
            if (Пузырёк.Checked)
            {
                int k = person.Length;
                Array.Resize(ref per, k);
                Array.Copy(person, per, k);
                kol = Sorts.Bubble(per, kol);
                dataGridView3.Rows[0].Cells[0].Value = kol.ToString();
                FillTable();
                Array.Clear(per, 0, k);
            }
            if (Быстрая.Checked)
            {
                int k = person.Length;
                Array.Resize(ref per, k);
                Array.Copy(person, per, k);
                kol = Sorts.Quick(per, 0, per.Length - 1, kol);
                dataGridView3.Rows[0].Cells[1].Value = kol.ToString();
                FillTable();
                Array.Clear(per, 0, k);
            }

            if (Выбором.Checked)
            {
                int k = person.Length;
                Array.Resize(ref per, k);
                Array.Copy(person, per, k);
                kol = Sorts.Selection(per, kol);
                dataGridView3.Rows[0].Cells[2].Value = kol.ToString();
                FillTable();
                Array.Clear(per, 0, k);
            }


            if (Вставками.Checked)
            {
                int k = person.Length;
                Array.Resize(ref per, k);
                Array.Copy(person, per, k);
                kol = Sorts.Insertion(per, kol);
                dataGridView3.Rows[0].Cells[3].Value = kol.ToString();
                FillTable();
                Array.Clear(per, 0, k);
            }

            if (Шелл.Checked)
            {
                int k = person.Length;
                Array.Resize(ref per, k);
                Array.Copy(person, per, k);
                kol = Sorts.Shell(per, kol);
                dataGridView3.Rows[0].Cells[4].Value = kol.ToString();
                FillTable();
                Array.Clear(per, 0, k);
            }
        }