Esempio n. 1
0
        public static void TestArray_ListFile(int seed)
        {
            int         n        = 12;
            string      filename = @"myTestArray.dat";
            MyFileArray myarray  = new MyFileArray(filename, n, seed);

            using (myarray.fs = new FileStream(filename, FileMode.Open, FileAccess.ReadWrite))
            {
                Console.WriteLine("---FileArray---");
                myarray.Print(n);
                Console.WriteLine();
                Console.WriteLine("---RadixSortedFileArray---");
                RadixSortArray(myarray);
                myarray.Print(n);
                Console.WriteLine();
            }
            filename = @"myTestList.dat";
            MyFileList mylist = new MyFileList(filename, n, seed);

            using (mylist.fs = new FileStream(filename, FileMode.Open, FileAccess.ReadWrite))
            {
                Console.WriteLine("---FileList---");
                mylist.Print(n);
                Console.WriteLine();
                Console.WriteLine("---RadixSortedFileList---");
                RadixSortList(mylist);
                mylist.Print(n);
                Console.WriteLine();
            }
        }
Esempio n. 2
0
        public static void AnalysisFILEArray_List(int seed, int kiek)
        {
            string filename = @"myTestArray.dat";
            int    n        = duomskc;

            Console.WriteLine("FileArray RadixSort");
            for (int i = 0; i < kiek; i++)
            {
                MyFileArray myarray = new MyFileArray(filename, n, seed);
                Stopwatch   timer   = new Stopwatch();
                using (myarray.fs = new FileStream(filename, FileMode.Open, FileAccess.ReadWrite))
                {
                    timer.Start();
                    Program.RadixSortArray(myarray);
                    timer.Stop();
                }
                //myarray.Print(n);
                Console.WriteLine("{0,-10}{1}", n, timer.Elapsed);
                n = n * 2;
            }
            Console.WriteLine();
            filename = @"myTestList.dat";
            n        = duomskc;
            Console.WriteLine("FileList RadixSort");
            Console.WriteLine("N         RunTime");
            for (int i = 0; i < kiek; i++)
            {
                MyFileList mylist = new MyFileList(filename, n, seed);
                Stopwatch  timer  = new Stopwatch();
                using (mylist.fs = new FileStream(filename, FileMode.Open, FileAccess.ReadWrite))
                {
                    timer.Start();
                    Program.RadixSortList(mylist);
                    timer.Stop();
                }
                //mylist.Print(n);
                Console.WriteLine("{0,-10}{1}", n, timer.Elapsed);
                n = n * 2;
            }
            Console.WriteLine();
            Console.WriteLine("---PABAIGA---");
        }