Exemplo n.º 1
0
        // resizes the hash table to the given capacity by re-hashing all of the keys
        private void resize(int capacity)
        {
            LinearProbingHashST <Key, Value> temp = new LinearProbingHashST <Key, Value>(capacity);

            for (int i = 0; i < M; i++)
            {
                if (keys[i] != null)
                {
                    temp.Put((Key)keys[i], (Value)vals[i]);
                }
            }
            keys = temp.keys;
            vals = temp.vals;
            M    = temp.M;
        }