Beispiel #1
0
        static void Main(string[] args)
        {
            //ArrayST<string,int> st = new ArrayST<string, int>(100);
            //BinarySearchST<string,int> st = new BinarySearchST<string, int>(100);
            //ZipperHashTableST<string,int> st = new ZipperHashTableST<string, int>(8);
            LinearProbingHashST <String, int> st = new LinearProbingHashST <string, int>(2);

            st.Put("A", 1);
            Console.WriteLine(st.Get("A")?.Value);
            st.Put("B", 2);
            st.Put("A", 3);
            st.Put("C", 1);
            st.Delete("A");
            st.Delete("gag");
        }
Beispiel #2
0
        private void Resize(int N)
        {
            HASH_SIZE = N;
            var st = new LinearProbingHashST <TKey, TValue>(N);

            for (int i = 0; i < _nodes.Length; i++)
            {
                if (_nodes[i] != null)
                {
                    st.Put(_nodes[i].Key, _nodes[i].Value);
                }
            }
            _nodes = st._nodes;
        }