public void MainTest() { var a = new IComparable[] { 10, 8, 6 }; var sorted = new IComparable[] { 6, 8, 10 }; var mSort = new JahongirSort(); mSort.Sort(a); CollectionAssert.AreEqual(sorted, a); }
public void WorstCaseComparison() { var stopWatch = new Stopwatch(); var collection = GetWorstCaseArray(20000); var a1 = (IComparable[])collection.Clone(); var a2 = (IComparable[])collection.Clone(); var mSort = new MaksimSort(); var jSort = new JahongirSort(); stopWatch.Start(); mSort.Sort(a1); stopWatch.Stop(); var mTime = stopWatch.ElapsedMilliseconds; stopWatch.Reset(); stopWatch.Start(); jSort.Sort(a1); stopWatch.Stop(); var jTime = stopWatch.ElapsedMilliseconds; Console.WriteLine($"# 90000: Jahongir time {jTime}, Maksim time {mTime}"); Console.WriteLine($"Maskim's algo is {mTime / jTime} times faster"); }