tableh.h

来自「Data Abstraction & Problem Solving with 」· C头文件 代码 · 共 41 行

H
41
字号
// *********************************************************// 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 + =
减小字号Ctrl + -
显示快捷键?