📄 tableh.h
字号:
// *********************************************************// 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.// *********************************************************#include "ChainNode.h"#include "TableException.h"typedef KeyedItem TableItemType;class HashTable{public:// constructors and destructor: HashTable(); HashTable(const HashTable& table); ~HashTable();// table operations: virtual bool tableIsEmpty() const; virtual int tableGetLength() const; virtual void tableInsert(const TableItemType& newItem) throw(TableException); virtual bool tableDelete(KeyType searchKey); throw(TableException); virtual bool tableRetrieve(KeyType searchKey, TableItemType& tableItem) const; throw(TableException);protected: int hashIndex(KeyType searchKey); // hash functionprivate: enum {HASH_TABLE_SIZE = 101}; // size of hash table typedef ChainNode * HashTableType[HASH_TABLE_SIZE]; HashTableType table; // hash table int size; // size of ADT table}; // end HashTable class// End of header file.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -