public SeparateChainingHashSymbolTable(int division)
        {
            this.division = division;
            size          = 0;

            datas = new SequentialSearchSymbolTable <TK, TV> [division];
            for (int i = 0; i < division; i++)
            {
                datas[i] = new SequentialSearchSymbolTable <TK, TV>();
            }
        }
Ejemplo n.º 2
0
        public void SequentialSearchTest()
        {
            int[] xs = { 3, 4, 5, 2, 6 };
            var   st = new SequentialSearchSymbolTable <int, int>();

            for (int i = 0; i < xs.Length; i++)
            {
                st.Put(i, xs[i]);
            }
            int v;

            for (int i = 0; i < xs.Length; i++)
            {
                if (st.TryGet(i, out v))
                {
                    Assert.Equal(xs[i], v);
                }
                else
                {
                    Assert.False(true);
                }
            }
        }