/* Filename: hash.h Programmer: Br. David Carlson Date: July 29, 2006 This header file sets up HashTableClass, a class for a small hash table kept in main memory. */ const int PrimeSize = 17; // The size of the table should be a prime number. const int EmptyItem = -1; const int DeletedItem = -2; typedef int KeyType; typedef KeyType TableArrayType[PrimeSize]; typedef int OrderArrayType[PrimeSize]; class HashTableClass { public: HashTableClass(void); // No specialized destructor is needed. bool Empty(void) const; bool Full(void) const; bool Insert(KeyType Key); bool Delete(KeyType Key); bool Lookup(KeyType Key, int & Index); // Normally, data fields are private, but they are public here so that // their data can be easily retrieved and displayed. TableArrayType TableArray; // Where the hash table data is stored. OrderArrayType OrderArray; // Keeps track of the rehash path used. private: int NumItems; // Number of items currently stored in the table. int Hash(KeyType Key) const; int Rehash(int Index) const; };