Пример #1
0
        private static void SingleThreaded(string[] args)
        {
            var inputFile  = args[0];
            var outputFile = args[1];

            var array = ReaderWriter.Read(inputFile);

            QuickSort.Sort(array, 0, array.Count - 1);

            ReaderWriter.Write(outputFile, array);
        }
Пример #2
0
        private static void SingleThreadedTest()
        {
            var array = new List <int> {
                0, -6, 3, 23, 1, 4
            };

            QuickSort.Sort(array, 0, array.Count - 1);

            array.ForEach(el => Console.WriteLine(el));
            Console.ReadKey();
        }
Пример #3
0
        private static bool Verify(IList <int> result, string inputFile)
        {
            QuickSort.PivotType = PivotType.Middle;

            var array = ReaderWriter.Read(inputFile);

            QuickSort.Sort(array, 0, array.Count - 1);

            QuickSort.PivotType = PivotType.Middle;

            var flag = true;

            for (int index = 0; index < result.Count; index++)
            {
                //Console.WriteLine($"Index {index}: {result[index]} ({array[index]})");

                if (result[index] != array[index])
                {
                    flag = false;
                }
            }

            return(flag);
        }