Example #1
0
        static void Main(string[] args)
        {
            HashTable <long> table = new HashTable <long>(79);

            table.Insert(200);
            table.Insert(300);
            table.Insert(1);
            table.Insert(2);
            Console.WriteLine("Enter a number");
            table.Insert(long.Parse(Console.ReadLine()));
            table.ShowHashTable();
            Console.WriteLine("HashTable contans 200?: " + table.ConntainsValue(200));
            Console.WriteLine("Count of elements: " + table.Count);
            Console.WriteLine("Enter a number to delete");
            long itemToDelete = long.Parse(Console.ReadLine());

            table.Remove(itemToDelete);
            Console.Write("Удаление элемента -> ");
            Console.WriteLine(itemToDelete);
            table.ShowHashTable();
            Console.ReadKey();
        }
Example #2
0
        private void btnLoad_Click(object sender, EventArgs e)
        {
            hashTable = new HashTable();

            if (rbSimpleHash.Checked)
            {
                hashTable.HashType = HashTable.hashFunctionType.Standart;
            }

            if (rbParametersHash.Checked)
            {
                hashTable.HashType = HashTable.hashFunctionType.WithParameters;

                hashTable.A = (int)nudA.Value;
                hashTable.B = (int)nudB.Value;
                hashTable.C = (int)nudC.Value;
            }

            hashTable.LoadFromFile();

            RefreshGraphics();
            Refresh();
        }