Beispiel #1
0
    static void Main()
    {
        Console.WriteLine("Please, enter the input filename");

        string infile = Console.ReadLine();
        // number of values = number of strings
        int number_of_values = System.IO.File.ReadAllLines(infile).Length;
        // timer
        var stopwatch = new Stopwatch();

        // array
        double[] ArraySort;
        double[] ArrayOut;
        ArraySort = ArrayFunctions.FileToArray(infile, number_of_values);

        Console.WriteLine("Number of values: {0}", number_of_values);

        stopwatch.Start();
        ArrayOut = Sort.Ins(ArraySort);
        stopwatch.Stop();
        ArrayFunctions.ArrayToFile(ArrayOut);
        Console.WriteLine();
        Console.WriteLine("Sort info: Insertion");
        Console.WriteLine();
        Console.WriteLine("Cycles:\t{0:###,###,###}", stopwatch.ElapsedTicks);
        Console.WriteLine("Ms:    \t{0:###,###}", stopwatch.ElapsedMilliseconds);
        stopwatch.Reset();

        stopwatch.Start();
        ArrayOut = Sort.InsR(ArraySort);
        stopwatch.Stop();
        ArrayFunctions.ArrayToFile(ArrayOut, "out_r.txt");
        Console.WriteLine();
        Console.WriteLine("Sort info: Insertion Reverse");
        Console.WriteLine();
        Console.WriteLine("Cycles:\t{0:###,###,###}", stopwatch.ElapsedTicks);
        Console.WriteLine("Ms:    \t{0:###,###}", stopwatch.ElapsedMilliseconds);
        stopwatch.Reset();

        Console.ReadKey();
    }