Ejemplo n.º 1
0
        public static void Test_OP_Radix_Sort(int seed, int n)
        {
            Console.WriteLine("\n Išorinėje atmintyje Radix rykiavimas\n");
            Stopwatch  watch   = new Stopwatch();
            MyIntArray myarray = new MyIntArray(n, seed);
            MyIntArray MySortedArray;

            Console.WriteLine("\n masyvas \n");
            myarray.Print(n);
            watch.Start();
            MySortedArray = (MyIntArray)RadixSort(myarray);
            watch.Stop();
            var arrayTime = watch.Elapsed;

            Console.WriteLine("\n išrykiuotas \n");
            MySortedArray.Print(n);

            MyIntList MySortedList;
            MyIntList mylist = new MyIntList(n, seed);

            //Console.WriteLine("\n sąrašas \n");
            mylist.Print(n);
            watch.Start();
            MySortedList = (MyIntList)RadixSort(mylist);
            watch.Stop();
            var listTime = watch.Elapsed;

            Console.WriteLine("\n isrykiuotas \n");
            MySortedList.Print(n);
            Console.WriteLine("array elapsed time: " + arrayTime + " list elapsed time: " + listTime);
        }
Ejemplo n.º 2
0
        public static void Test_Array_List(int seed, int n)
        {
            Console.WriteLine("elementų kiekis: " + n);
            Console.WriteLine("\n Operatyviojoje atmintyje suliejimo rykiavimas\n");
            Stopwatch   watch   = new Stopwatch();
            MyDataArray myarray = new MyDataArray(n, seed);
            MyDataArray MySortedArray;
            MyDataList  MySortedList;

            Console.WriteLine("\n masyvas \n");
            myarray.Print(n);
            watch.Start();
            MySortedArray = (MyDataArray)MergeSort(myarray);
            watch.Stop();
            var arrayTime = watch.Elapsed;

            Console.WriteLine("\n isrykiuotas \n");
            MySortedArray.Print(n);
            MyDataList mylist = new MyDataList(n, seed);

            Console.WriteLine("\n sąrašas \n");
            mylist.Print(n);
            watch.Start();
            MySortedList = (MyDataList)MergeSort(mylist);
            watch.Stop();
            var listTime = watch.Elapsed;

            Console.WriteLine("\n isrykiuotas \n");
            MySortedList.Print(n);
            Console.WriteLine("masyvo vykdymo laikas: " + arrayTime + " sąrašo vykdymo laikas: " + listTime);
        }