?? kbinarytreenode.h
字號:
#ifndef __KBINARY_TREE_NODE_H
#define __KBINARY_TREE_NODE_H
#ifndef __TEST_WIN32
extern "C"
{
#include "ntddk.h"
}
#include "../Include/KNew.h"
#include "../Include/KTypes.h"
#else
#include <windows.h>
#endif //__TEST_WIN32
class KBinaryTree;
class KBinaryTreeNode;
//*******************************************************************//
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
typedef int (*BTREE_COMPARE)(VOID*, VOID*, ULONG);
class KBinaryTreeNode
{
friend class KBinaryTree;
public:
explicit
KBinaryTreeNode(VOID* data, int balance = 0, KBinaryTreeNode* parent = NULL, KBinaryTreeNode* left = NULL, KBinaryTreeNode* right = NULL);
virtual ~KBinaryTreeNode();
protected:
BOOLEAN RestructureInsert();
BOOLEAN RestructureDelete();
KBinaryTreeNode* SearchByNode(VOID* data, BTREE_COMPARE pCompare, ULONG dwCompareParam);
BOOLEAN IsRoot();
BOOLEAN IsLeftSibling();
BOOLEAN IsRightSibling();
BOOLEAN HasLeftSibling();
BOOLEAN HasRightSibling();
LONG GetDepthNode();
LONG GetLevel();
LONG NodesInTreeByNode();
KBinaryTreeNode* GetRootByNode();
KBinaryTreeNode* GetLeftSibling();
KBinaryTreeNode* GetRightSibling();
KBinaryTreeNode* GetFirstNodeInOrder();
KBinaryTreeNode* GetLastNodeInOrder();
KBinaryTreeNode* GetPrevNodeInOrder();
KBinaryTreeNode* GetNextNodeInOrder();
KBinaryTreeNode* GetInsertPosition(VOID* data, BTREE_COMPARE pCompare, ULONG dwCompareParam);
BOOLEAN LeftRotation();
BOOLEAN RightRotation();
BOOLEAN DoubleRotationLeft();
BOOLEAN DoubleRotationRight();
private:
KBinaryTreeNode(const KBinaryTreeNode&);
KBinaryTreeNode& operator=(const KBinaryTreeNode& right);
protected:
KBinaryTreeNode* m_pParent;
KBinaryTreeNode* m_pRight;
KBinaryTreeNode* m_pLeft;
int m_nBalance;
void* m_pData;
private:
};
#endif //__KBINARY_TREE_NODE_H
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -