Beispiel #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("---HeapSortedFileArray---");
                HeapSortArray.HeapSortas(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("---HeapSortedFileList---");
                HeapSortList.HeapSortas(mylist);
                mylist.Print(n);
                Console.WriteLine();
            }
        }
Beispiel #2
0
        public static void TestArray_List(int seed)
        {
            int         n       = 12;
            MyDataArray myArray = new MyDataArray(n, seed);

            Console.WriteLine("---Array---");
            myArray.Print(n);
            Console.WriteLine();
            Console.WriteLine("---HeapSortedArray---");
            HeapSortArray.HeapSortas(myArray);
            myArray.Print(n);
            Console.WriteLine();
            MyDataList myList = new MyDataList(n, seed);

            Console.WriteLine("---List---");
            myList.Print(n);
            Console.WriteLine();
            Console.WriteLine("---HeapSortedList---");
            HeapSortList.HeapSortas(myList);
            myList.Print(n);
            Console.WriteLine();
        }