Example #1
0
        private void CheckResize()
        {
            if (length / size < 0.5)
            {
                return;
            }
            MyHashTable <TKey, TValue> table = new MyHashTable <TKey, TValue>(FindNextPrime(size));

            foreach (KeyValuePair <TKey, TValue> pair in this)
            {
                table.Add(pair);
            }
            baseArray = table.baseArray;
            size      = table.size;
        }
Example #2
0
        public static void Main(string[] args)
        {
            MyHashTable <string, float> blah = new MyHashTable <string, float>();

            blah["abcd"] = 8457;
            blah["nael"] = 2139;
            blah["face"] = 3849;
            blah["foob"] = 6749;
            blah["food"] = 9345;
            blah["uido"] = 4798;
            blah["mdjt"] = 2847;
            blah["andu"] = 8472;
            blah["ifos"] = 2759;
            blah["pael"] = 2284;
            blah["urke"] = 2785;
            blah["aheu"] = 3758;
            Console.WriteLine(blah ["food"]);
        }