⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chashtable.h

📁 clique code with sample data set. clique is a data clustering algorithm which follows hierarchical c
💻 H
字号:
#ifndef _CHASH_
#define _CHASH_

using namespace std;
#define HASHNS __gnu_cxx

#include <list.h>
//#include <map.h>
#include <ext/hash_map>
#include <vector.h>
#include <iostream.h>


class cHashItem{
private:
   vector<int> iset;
   int sup;
   int hval;
public:
   cHashItem(vector<int> &iary, int lit, int isup, int ihval);
   int hashval() { return hval;}
   int support() { return sup; }
   vector<int> &itemset() { return iset; }
   bool subset (cHashItem *ia);
   static int compare (cHashItem *ia, cHashItem *ib);
   friend ostream& operator << (ostream& fout, cHashItem& lst);
};


#define HASHSIZE 100
struct cHash
{
   size_t operator() (int x) const { return (x%HASHSIZE); }
};


//typedef map<int, list<cHashItem *> *, less<int> > cHTable;
//typedef hash_map<int, list<cHashItem *> *, cHash, equal_to<int> > cHTable;
typedef HASHNS::hash_multimap<int, cHashItem *,   
   HASHNS::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=HASHSIZE): chtable(sz){}
   
   bool add(vector<int> &iset, int lit, int isup, int ihval);
   bool list_add(cHashItem *Hitem);

   void print_hashstats(){
      cout << "HASHSTATS " << chtable.size() << " " 
           << chtable.bucket_count() << endl;
   }
   
};

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -