?? btree.h
字號(hào):
//為了防止出現(xiàn)線性二叉樹, 必須要注意二叉樹的平衡
#ifndef __BTREE_H__ //__BTREE_H__
#define __BTREE_H__
template<typename T> struct node
{
T data;
int bf; //balance flag
node<T> *lnext,*rnext;
};
enum
{
RH = -1,
EH = 0,
LH = 1
};
template<class T> class CBTree
{
private:
void RotateLeft(node<T> **root);
void RotateRight(node<T> **root);
void LeftBalance(node<T> **root);
void RightBalance(node<T> **root);
public:
int InsertAVL(node<T> **p_root, T key,node<T> **p_keypos, bool &taller);
int DeleteAVL(node<T> **p_root, T key,node<T> **p_keyparentpos, bool &lower);
int SearchAVL(node<T> *p_root, T key,node<T> **p_keypos);
CBTree();
~CBTree();
};
#endif //__BTREE_H__
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -