private void button3_Click(object sender, EventArgs e) { textBox4.Clear(); int swaps, equal; Sortclass.gnomsort(students, out equal, out swaps); for (int k = 0; k < students.Count; k++) { textBox4.AppendText(students[k].printinfo()); } MessageBox.Show("number of iterations: " + swaps + "\n" + "number of comparisons: " + equal); issorted = true; }
private void button7_Click(object sender, EventArgs e) { textBox4.Clear(); int swaps = 0, equal = 0; Student[] studarr = new Student[students.Count]; for (int i = 0; i < studarr.Length; i++) { studarr[i] = students[i]; } Sortclass.BubbleSort(studarr, ref equal, ref swaps); for (int k = 0; k < studarr.Length; k++) { textBox4.AppendText(studarr[k].printinfo()); } MessageBox.Show("number of iterations: " + swaps + "\n" + "number of comparisons: " + equal); issorted = true; }