/// <summary>
 /// Initializes an empty symbol table with <c>M</c> chains.</summary>
 /// <param name="M">the initial number of chains</param>
 ///
 public SeparateChainingHashST(int M)
 {
     this.M = M;
     st     = new SequentialSearchST <Key, Value> [M];
     for (int i = 0; i < M; i++)
     {
         st[i] = new SequentialSearchST <Key, Value>();
     }
 }
Beispiel #2
0
        public static void MainTest(string[] args)
        {
            SequentialSearchST <string, int> st = new SequentialSearchST <string, int>();
            TextInput StdIn = new TextInput();

            string[] keys = StdIn.ReadAllStrings();

            for (int i = 0; i < keys.Length; i++)
            {
                st.Put(keys[i], i);
            }
            foreach (string s in st.Keys())
            {
                Console.WriteLine("{0} {1}", s, st.Get(s));
            }
        }