Exemplo n.º 1
0
        public void MedianDriverSrtRstRnd(string[] array)
        {
            var timer = new Stopwatch();

            for (int i = 0; i < array.Length; i++)
            {
                HeapSortClass heapSortClass = new HeapSortClass();
                int[]         qs            = heapSortClass.CheckFile(array[i]);
                timer.Start();
                MedianQuickSort(qs, 0, qs.Length - 1);
                timer.Stop();
                Console.WriteLine(timer.Elapsed + " for file " + array[i] + " using Median of 3");
                using (StreamWriter streamWriter = File.AppendText("MedianQuickSortSrtRstRnd.txt"))
                {
                    streamWriter.WriteLine(timer.Elapsed + " for file " + array[i]);
                }
                timer.Reset();
            }
        }
Exemplo n.º 2
0
        public void Driver(string[] array)
        {
            var timer = new Stopwatch();

            for (int i = 0; i < array.Length; i++)
            {
                HeapSortClass heapSortClass = new HeapSortClass();
                int[]         qs            = heapSortClass.CheckFile(array[i]);
                timer.Start();
                QuickSort(qs, 0, qs.Length - 1);
                timer.Stop();
                Console.WriteLine(timer.Elapsed + " for size " + qs.Length);
                using (StreamWriter streamWriter = File.AppendText("QuickSort.txt"))
                {
                    streamWriter.WriteLine(timer.Elapsed + " for size " + qs.Length);
                }
                timer.Reset();
            }
        }