// This is the header file for Display 17.24. This is the interface // for the class HashTable, which is a class for a hash table // of strings. // It is the same as hashtable.h. #ifndef HASHTABLE_H #define HASHTABLE_H #include #include "listtools.h" using LinkedListSavitch::Node; using std::string; namespace HashTableSavitch { const int SIZE = 10; class HashTable { public: HashTable(); // Initialize empty hash table // Normally a copy constructor and overloaded assignment // operator would be included. They have been omitted // to save space. virtual ~HashTable(); // Destructor destroys hash table bool containsString(string target) const; // Returns true if target is in the hash table, // false otherwise void put(string s); // Adds a new string to the hash table private: Node *hashArray[SIZE]; static int computeHash(string s); // Compute hash value for string }; // HashTable } // HashTableSavitch #endif // HASHTABLE_H