// ********************************************************* // Header file TableH.h for the ADT table. // Hash table implementation. // Assumption: A table contains at most one item with a // given search key at any time. // ********************************************************* typedef desired-type-of-search-key keyType; #include "Data.h" // definition of itemClass typedef itemClass tableItemType; struct chainNode; // defined in implementation file typedef chainNode* ptrType; // pointer to node class tableClass { public: // constructors and destructor: tableClass(); tableClass(const tableClass& T); ~tableClass(); // table operations: virtual bool TableIsEmpty() const; virtual int TableLength() const; virtual void TableInsert(const tableItemType& NewItem, bool& Success); virtual void TableDelete(keyType SearchKey, bool& Success); virtual void TableRetrieve(keyType SearchKey, tableItemType& TableItem, bool& Success) const; protected: int HashIndex(keyType SearchKey); // hash function private: enum {HASH_TABLE_SIZE = 101}; // size of hash table typedef ptrType hashTableType[HASH_TABLE_SIZE]; hashTableType T; // hash table int Size; // size of ADT table }; // end class // End of header file.