bitree.h

来自「自己写的C++程序,水平还很有限,希望高手能够指点迷津,我将很感谢,真的很想成为」· C头文件 代码 · 共 41 行

H
41
字号
// bitree.h: interface for the bitree class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_BITREE_H__FFCF161E_BC53_4497_9086_C8854C8EF8CB__INCLUDED_)
#define AFX_BITREE_H__FFCF161E_BC53_4497_9086_C8854C8EF8CB__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
typedef char Type;
struct BiTNode
{
 Type data;
 struct BiTNode *lchild,*rchild;
};
class BiTree  
{
	BiTNode* root;
    int static sign;
public:
    int getsign();
	void Insert(BiTNode *T,BiTNode *p,bool left);
BiTNode * getroot();
BiTNode* Find(BiTNode *p,Type e,BiTNode *&q);

	int PreOrderCreatBiTree(BiTNode* &T);
	static void PreTraverse(BiTNode* T);
	static int Depth(BiTNode *p);
	int Depth(){ return Depth(root); }
	void PreTraverse(){ PreTraverse(root); }
	BiTNode *LeftChild( BiTNode *p);
	BiTNode *RightChild( BiTNode *p );
	void SetRoot( BiTNode* T ){  root = T ; }
	BiTNode *GetRoot( )const{ return root; }
	BiTree(){ root = 0; }
	BiTree(BiTNode* T){ root = T; }
	virtual ~BiTree();
};
#endif // !defined(AFX_BITREE_H__FFCF161E_BC53_4497_9086_C8854C8EF8CB__INCLUDED_)

⌨️ 快捷键说明

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