private void resize(int cap) { LinearProbingHashST <Key, Value> t; t = new LinearProbingHashST <Key, Value>(cap); for (int i = 0; i < M; i++) { if (keys[i] != null) { t.put(keys[i], vals[i]); } } keys = t.keys; vals = t.vals; M = t.M; }
static void Main(string[] args) { LinearProbingHashST <int, string> st = new LinearProbingHashST <int, string>(); Console.WriteLine("Input Hash Table :"); for (int i = 1; i <= 16; i++) { st.put(i, $"{char.ConvertFromUtf32(i + 64)}"); Console.WriteLine("{0} {1}", i, $"{char.ConvertFromUtf32(i + 64)}"); } Console.WriteLine("End Input Hash Table;"); Console.Write("Find by Key :"); Console.WriteLine("Value = {0}", st.get(int.Parse(Console.ReadLine()))); //st.print(); Console.ReadKey(); }