Пример #1
0
        static void Main(string[] args)
        {
            //Need to give a default hash table size
            int capacity = 10;
            //IHashTable<string, string> ht = new BasicHashTable<string, string>(capacity);
            IHashTable <string, string> ht = new ComplexHashTable <string, string>(capacity);


            long[] numbers = { 1000, 2000, 3000, 4000, 5000, 6000, 7000 };
            Helper <string, string> .TestAddTime(numbers);

            Helper <string, string> .TestAllPurposes(ht);

            Console.WriteLine("---");
        }
Пример #2
0
            //test for time complexity for add function O(n)
            static public void TestAddTime(long[] numbers)
            {
                //TestTime
                long[] times = new long[7];
                int    i     = 0;

                foreach (var num in numbers)
                {
                    Console.WriteLine(num);
                    IHashTable <K, V> ht = new ComplexHashTable <K, V>(10);
                    var watch            = System.Diagnostics.Stopwatch.StartNew();
                    AddAll(ht, num);
                    watch.Stop();
                    var elapsedMs = watch.ElapsedMilliseconds;
                    times[i] = elapsedMs;
                    Console.WriteLine(elapsedMs);
                    i++;
                }
                times = null;
            }