📄 fttree.h
字号:
// FTTree.h: interface for the FTTree class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_FTTREE_H__14ECC2DE_6C31_4B83_8138_C2254F306AF5__INCLUDED_)
#define AFX_FTTREE_H__14ECC2DE_6C31_4B83_8138_C2254F306AF5__INCLUDED_
#define EMPTY -1
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class FTNode
{
public:
int lkey;
int ckey;
int rkey;
FTNode* left;
FTNode* lcenter;
FTNode* rcenter;
FTNode* right;
public:
bool isleaf(){return left==NULL;}
FTNode(){left=lcenter=rcenter=right=NULL;lkey=ckey=rkey=EMPTY;}
};
class FTTree
{
public:
FTNode *root;
FTNode number;
FTTree();
virtual ~FTTree();
bool find(FTNode* subroot,const int& k)
{
if(subroot==NULL) return false;
if(k==subroot->lkey){ return true;}
if(k==subroot->ckey && subroot->ckey!=EMPTY)
return true;
if(k==subroot->rkey)
return true;
if(k < subroot->lkey)
return find(subroot->left,k);
else if(subroot->ckey==EMPTY)
return find(subroot->lcenter,k);
else if(k < subroot->ckey)
return find (subroot->lcenter,k);
else if(subroot->rkey==EMPTY)
return find(subroot->rcenter,k);
else if(k<subroot->rkey)
return find(subroot->rcenter,k);
else if (k > subroot->rkey)
return find(subroot->right,k);
}
bool insert(FTNode*& subroot,const int & e ,int &retval, FTNode*& retptr);
void printnode(FTNode * node);
bool splitenode(FTNode*& subroot,const int & inval ,FTNode *inptr,int & retval, FTNode*& retptr);
};
#endif // !defined(AFX_FTTREE_H__14ECC2DE_6C31_4B83_8138_C2254F306AF5__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -