//========================================== // lookup //========================================== // Return the value associated with key x // in hash table T. If x is not one of // the keys in T, return an empty string. //========================================== string lookup(string x, HashTable& T) { int h = strhash(x.c_str()) % T.size; for(ListCell* p = T.A[h]; p != NULL; p = p->next) { if(x == p->key) { return p->value; } } return (string) ""; }