Esempio n. 1
0
        static void Main(string[] args)
        {
            HashTable table  = new HashTable(100);
            Random    random = new Random();

            Console.WriteLine("60 random numbers: ");
            for (int i = 0; i < 60; i++)
            {
                int number = random.Next(1, 450);
                Console.Write(number + " ");
                table.Add(number);
            }
            Console.WriteLine();

            Console.WriteLine("Collisions: " + table.Collisions);

            Console.WriteLine("Table: ");
            table.PrintTable();

            Console.WriteLine();

            table = new HashTable(100);

            Console.WriteLine("90 random numbers: ");
            for (int i = 0; i < 90; i++)
            {
                int number = random.Next(1, 450);
                Console.Write(number + " ");
                table.Add(number);
            }
            Console.WriteLine();


            Console.WriteLine("Collisions: " + table.Collisions);

            Console.WriteLine("Table: ");
            table.PrintTable();
        }