private void LSDRadixSortButton_Click(object sender, EventArgs e) { LSDLabel.Text = "Time: "; var LSDRadix = new LSDRadixSort <int>(Collection, "LSDRadixSort"); LSDRadix.Sort(); DisplayInfoFromSort(LSDRadix); LSDLabel.Text += LSDRadix.Time.ToString(); }
public void LSDRadixSortTest() { //arrange var LSDradix = new LSDRadixSort <int>(dataList, "LSD"); //act LSDradix.Sort(); //assert for (int i = 0; i < count; i++) { Assert.AreEqual(sortedItems[i], LSDradix.Items[i]); } }
public void LSDRadixSortTest() { // arrange var lsdRadix = new LSDRadixSort <int>(); lsdRadix.Items.AddRange(items); // act lsdRadix.Sort(); // assert for (int i = 0; i < items.Count; i++) { Assert.AreEqual(sorted[i], lsdRadix.Items[i]); } }
public void RadixTest() { //arrange var radix = new LSDRadixSort <int>(); radix.Items.AddRange(Items); //act radix.Sort(); //assert for (int i = 0; i < Items.Count; i++) { Assert.AreEqual(Sorted[i], radix.Items[i]); } }
private void AllSortButton_Click(object sender, EventArgs e) { SortDatarichTextBox.Text = "Calculating ... Wait a moment ..."; BubbleLabel.Text = "Time: "; SelectionLabel.Text = "Time: "; CocktailLabel.Text = "Time: "; GnomeLabel.Text = "Time: "; HeapLabel.Text = "Time: "; InsertionLabel.Text = "Time: "; LSDLabel.Text = "Time: "; MSDLabel.Text = "Time: "; MergeLabel.Text = "Time: "; QuickLabel.Text = "Time: "; ShellLabel.Text = "Time: "; TreeLabel.Text = "Time: "; SortDatarichTextBox.Text = ""; var min = new List <BaseAlgorithm <int> >(); if (Collection.Count < 10001) { var bubble = new BubbleSort <int>(Collection, "BubbleSort"); bubble.Sort(); BubbleLabel.Text += bubble.Time.ToString(); min.Add(bubble); } if (Collection.Count < 10001) { var selection = new SelectionSort <int>(Collection, "SelectionSort"); selection.Sort(); SelectionLabel.Text += selection.Time.ToString(); min.Add(selection); } if (Collection.Count < 10001) { var cocktail = new CocktailSort <int>(Collection, "CocktailSort"); cocktail.Sort(); CocktailLabel.Text += cocktail.Time.ToString(); min.Add(cocktail); } if (Collection.Count < 10001) { var Gnome = new GnomeSort <int>(Collection, "GnomeSort"); Gnome.Sort(); GnomeLabel.Text += Gnome.Time.ToString(); min.Add(Gnome); } if (Collection.Count < 10001) { var Insertion = new InsertionSort <int>(Collection, "InsertionSort"); Insertion.Sort(); InsertionLabel.Text += Insertion.Time.ToString(); min.Add(Insertion); } var Tree = new TreeSort <int>(Collection, "TreeSort"); Tree.Sort(); TreeLabel.Text += Tree.Time.ToString(); min.Add(Tree); var Heap = new HeapSort <int>(Collection, "HeapSort"); Heap.Sort(); HeapLabel.Text += Heap.Time.ToString(); min.Add(Heap); var LSDRadix = new LSDRadixSort <int>(Collection, "LSDRadixSort"); LSDRadix.Sort(); LSDLabel.Text += LSDRadix.Time.ToString(); min.Add(LSDRadix); var MSDRadix = new MSDRadixSort <int>(Collection, "MSDRadixSort"); MSDRadix.Sort(); MSDLabel.Text += MSDRadix.Time.ToString(); min.Add(MSDRadix); var Merge = new MergeSort <int>(Collection, "MergeSort"); Merge.Sort(); MergeLabel.Text += Merge.Time.ToString(); min.Add(Merge); var Quick = new QuickSort <int>(Collection, "QuickSort"); Quick.Sort(); QuickLabel.Text += Quick.Time.ToString(); min.Add(Quick); var Shell = new ShellSort <int>(Collection, "ShellSort"); Shell.Sort(); ShellLabel.Text += Shell.Time.ToString(); min.Add(Shell); var best = GetMinTime(min); SortDatarichTextBox.Text = $"THE BEST:\n" + best.Name + $"\n{best.Time}"; }