⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tree.h

📁 《Visual C++ Bible》或者说是《Visual C++ 宝典》的对应的源码文件
💻 H
字号:
///////////////////////////////////////////////////////////////////////
//
// Tree.h - contains definitions of the base "Tree" structure.
//
// @(#)$Header:$
//
// Description:
//		This file contains the base type and information for the bare
//		sorting and searching routines in the Tree module.  It needs
//		to be augmented to do anything that is actually useful.
//
///////////////////////////////////////////////////////////////////////

class Tree;

class Node {
	protected:
		Node *left;
		Node *right;
	private:
		void balance();
		void list(int depth);
	public:
		Node();
		virtual int is_greater(Node *t)	= 0;
		virtual int is_equal(Node *t)	= 0;
		virtual void print()			= 0;
		friend Tree;
};

class Tree {
	protected:
		Node *root;
	public:
		Tree();
		Node *insert(Node *x);
		Node *search(Node *x);
		void list();
};

⌨️ 快捷键说明

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