Category Archives: Algorithms
Worst Case Scenario for QuickSort
Take a look at the following code: var sw = new Stopwatch(); sw.Start(); Enumerable.Range(0, 3).SelectMany((i) => Enumerable.Range(0, 50000)).OrderBy(i => i).ToList(); Console.WriteLine(sw.ElapsedMilliseconds); sw.Reset(); sw.Start(); Enumerable.Range(0, 2).SelectMany((i) => Enumerable.Range(0, 50000)).OrderBy(i => i).ToList(); Console.WriteLine(sw.ElapsedMilliseconds); sw.Reset(); Line 4 is saying: Generate a list which … Continue reading
Posted in Algorithms, C#
Leave a comment