public void Remove(Key key) { LinkedList3 <Key, Value> list = hashtable[Hash(key)]; if (list.Contains(key)) { list.Remove(key); N--; } }
public HashST2(int M) { this.M = M; N = 0; hashtable = new LinkedList3 <Key, Value> [M]; for (int i = 0; i < M; i++) { hashtable[i] = new LinkedList3 <Key, Value>(); } }
public void Add(Key key, Value value) { LinkedList3 <Key, Value> list = hashtable[Hash(key)]; if (list.Contains(key)) { list.Set(key, value); } else { list.Add(key, value); N++; } }
public LinkedList3Dictionary() { list = new LinkedList3 <Key, Value>(); }
public void Set(Key key, Value newValue) { LinkedList3 <Key, Value> list = hashtable[Hash(key)]; list.Set(key, newValue); }
public Value Get(Key key) { LinkedList3 <Key, Value> list = hashtable[Hash(key)]; return(list.Get(key)); }
public bool Contains(Key key) { LinkedList3 <Key, Value> list = hashtable[Hash(key)]; return(list.Contains(key)); }