hashtree.h

来自「本程序实现的是关联规则挖掘领域中规则发现算法.」· C头文件 代码 · 共 52 行

H
52
字号
// HashTree.h: interface for the CHashTree class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_HASHTREE_H__65930613_0F74_4631_8520_4D5F779D9F6A__INCLUDED_)
#define AFX_HASHTREE_H__65930613_0F74_4631_8520_4D5F779D9F6A__INCLUDED_

#include "List.h"
#include "itemSet.h"

#define BUCKET_SIZE 100 /* the number of buckets in the hash tree*/
#define TABLE_SIZE 500 /* the number of buckets in the hash tree*/

#define LEAF     1
#define INTERNAL 2

/* node in the hash tree*/
typedef struct hashnode HashNode;
struct hashnode
{
    int nodetype;  /* nodetype L=leaf, N=non-terminal node*/
    
    union {
            List *largeset; /*corresponding to a leaf node*/
            HashNode *tab[TABLE_SIZE]; /*corresponding to a non-tem node, each bucket points to another node*/
    } vp;
};


class CHashTree {

public:

    HashNode *root;
    
    CHashTree();
    ~CHashTree();
    
    int hash(itemSet *itemset, int level);
    
    HashNode * newnode(int nodetype);
    void freenode(HashNode *node);

    void insert(HashNode **hp, itemSet *s, int level );
    void subset(HashNode *head, itemSet *t, int m);

    void scan(HashNode *head, List *result, long minsup);
    
};

#endif // !defined(AFX_HASHTREE_H__65930613_0F74_4631_8520_4D5F779D9F6A__INCLUDED_)

⌨️ 快捷键说明

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