Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Loading array from file...");
            var array = LoadArrayFromFile("largeArray.txt");
            Console.WriteLine("Array loaded");

            Console.WriteLine("Started sorting the array");
            var stopwatch = Stopwatch.StartNew();

            var mergeSort = new MergeSort();
            mergeSort.Sort(array);

            stopwatch.Stop();
            Console.WriteLine("Array sorted");

            // Elapsed time: 7600 ms
            Console.WriteLine($"Elapsed time: {stopwatch.Elapsed.TotalMilliseconds} ms");
        }
Exemplo n.º 2
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Loading array from file...");
            var array = LoadArrayFromFile("largeArray.txt");

            Console.WriteLine("Array loaded");

            Console.WriteLine("Started sorting the array");
            var stopwatch = Stopwatch.StartNew();

            var mergeSort = new MergeSort();

            mergeSort.Sort(array);

            stopwatch.Stop();
            Console.WriteLine("Array sorted");

            // Elapsed time: 7600 ms
            Console.WriteLine($"Elapsed time: {stopwatch.Elapsed.TotalMilliseconds} ms");
        }