📄 hashtable.h,v
字号:
head 1.2;access;symbols;locks zaki:1.2; strict;comment @ * @;1.2date 2001.06.24.21.17.20; author zaki; state Exp;branches;next 1.1;1.1date 2001.06.12.16.41.58; author zaki; state Exp;branches;next ;desc@Charm with Hashing.@1.2log@added use_hash_map@text@#ifndef __HASHTABLE_H#define __HASHTABLE_H#include <hash_map.h> #include "Itemset.h"#include "List.h"#define HASHSIZE 100000class HashItem;class HashTable {private: unsigned int theSize; int num_find; int num_probe; Array< List<HashItem *> * > *theCells;public: HashTable (int sz=HASHSIZE); ~HashTable(); int add (Itemset *); void clear(); //simply clear cells without deleting contents void clear_cells(); //deletes cell contents inline int size() { return theSize; } void print(); friend ostream& operator << (ostream&, HashTable&);};class HashItem {private: Array<int> *ary; int sup; int hval;public: HashItem(Itemset *item, int hashsize); HashItem(Itemset *item); int HashVal() { return hval;} int support() {return sup;} Array<int>* array() { return ary; } bool subset(HashItem *ia); static int cmp (const void *a, const void *b); static int cmp2 (const void *a, const void *b); friend ostream& operator << (ostream& fout, HashItem& lst);};#define cHASHSIZE 100typedef hash_multimap<int, HashItem *, hash<int>, equal_to<int> > cHTable;typedef pair<cHTable::iterator, cHTable::iterator> cHTFind;typedef cHTable::value_type cHTPair;class cHashTable{public: cHTable chtable; cHashTable(int sz=cHASHSIZE): chtable(sz){} bool add(Itemset *iset); void print_hashstats(){ cout << "HASHSTATS " << chtable.size() << " " << chtable.bucket_count() << endl; }}; #endif //__HASHTABLE_H@1.1log@Initial revision@text@d3 1d7 3d18 1a18 1 HashTable (int);d33 15a47 11 private: Array<int> *ary; int sup; int hval; public: HashItem(Itemset *item, int hashsize); int HashVal() { return hval;} int support() {return sup;} Array<int>* array() { return ary; } static int cmp (const void *a, const void *b); friend ostream& operator << (ostream& fout, HashItem& lst);d50 20@
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -