Sort() public method

public Sort ( int array ) : void
array int
return void
        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");
        }
示例#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");
        }