public static double time(string alg, IComparable[] a) { Stopwatch timer = new Stopwatch(); timer.Start(); switch (alg) { case "Insertion": Insertion.sort(a); break; case "Selection": Selection.sort(a); break; case "Shell": Shell.sort(a); break; case "Merge": Merge.sort(a); break; case "Quick": throw new NotImplementedException(); case "Heap": throw new NotImplementedException(); } timer.Stop(); return(timer.ElapsedMilliseconds); }
public void sort_InputStringArray_AscendingOrder() { string[] s = { "S", "O", "R", "T", "E", "X", "A", "M", "P", "L", "E" }; Insertion.sort(s); Assert.True(BaseSort.isSorted(s)); }