public void Remove(Key key) { LinkedList3 <Key, Value> list = hashtable[Hash(key)]; if (list.Contains(key)) { list.Remove(key); N--; } }
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++; } }
//O(n) public bool ContainsKey(Key key) { return(list.Contains(key)); }
public bool Contains(Key key) { LinkedList3 <Key, Value> list = hashtable[Hash(key)]; return(list.Contains(key)); }