util.h
来自「apriori算法是数据挖掘的经典算法,它基于关联规则的思想.此为我的第3个收藏」· C头文件 代码 · 共 108 行
H
108 行
//---------------------------------------------------------------------------#ifndef UtilityH#define UtilityH#define PI 3.1415926class ItemSets;typedef int Item;/* to find the minimum and maximum integer from two parameters */#define imax(a, b) (((a) > (b))?(a):(b))#define imin(a, b) (((a) < (b))?(a):(b))// Relationship between two ItemSet s#define TOTALEQUAL 0#define MAKEUP 1#define TOTALDIFF 2#define CROSS 3class ItemSet {private: Item* m_items;public: bool keeporder; int count; long support; ItemSet() { m_items = (Item *)NULL; count = 0; support = 0; keeporder = true; }; ~ItemSet() { delete m_items; }; void add(Item theitem); void clear(); Item remove(int index); int indexof(Item theitem); Item itemof(int index); void insert(int index, Item theitem); ItemSet *clone(); void cat(ItemSet *src); ItemSet *sub(int bgn, int end); int diff(ItemSet *theother); ItemSet *substract(ItemSet *itemSet);};typedef struct ItemSetChain ItemSetNode;struct ItemSetChain { ItemSet *m_data; ItemSetNode *priori; ItemSetNode *next;};class ItemSets {public: ItemSetNode *m_itemsethead; int count; int cur_pos; ItemSetNode *cur_itemset; int varnum; ItemSets(); ~ItemSets(); ItemSetNode *nodeof(int order); ItemSet *pointof(int order); ItemSet *itemsetof(int order); ItemSet *add(ItemSet *NewItemSet); bool remove(int order); int indexof(ItemSet *test); void writeto(char *filename); void cat(ItemSets *Additions);};#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?