Ejemplo n.º 1
0
        static void SimpleCounterMedium()
        {
            Console.WriteLine("Simple - Counter - Medium");
            Console.WriteLine("ArraySize;Counter");
            SearchClass sc   = new SearchClass();
            Random      rand = new Random();

            for (long i = 2000000; i <= (long)Math.Pow(2, 28); i += 2000000)
            {
                long min   = long.MaxValue;
                long max   = long.MinValue;
                long total = 0;
                for (int j = 0; j < 12; j++)
                {
                    sc.SimpleSearchWithCounter(CreateAndFillArray(i), rand.Next(0, 1000));
                    total += sc.counter;
                    if (sc.counter > max)
                    {
                        max = sc.counter;
                    }
                    if (sc.counter < min)
                    {
                        min = sc.counter;
                    }
                }

                Console.WriteLine("{0};{1}", i, (total - (max + min)) / 10);
            }
        }
Ejemplo n.º 2
0
        static void SimpleCounterPesymistic()
        {
            Console.WriteLine("Simple - Counter - Pesymistic");
            Console.WriteLine("ArraySize;Counter");
            SearchClass sc = new SearchClass();

            for (long i = 2000000; i <= (long)Math.Pow(2, 28); i += 2000000)
            {
                sc.SimpleSearchWithCounter(CreateAndFillArray(i), 1001);
                Console.WriteLine("{0};{1}", i, sc.counter);
            }
        }