二叉搜索树就地转双向链表二叉搜索树头文件C++

 
//	binarySearchTree.h -- 2011-07-27-17.14
class binarySearchTree
{
public:
	enum direction {Direction_Left, Direction_Right} ;
	typedef int Item ;
	typedef struct node
	{
		Item item ;
		struct node * left, * right ;
	} Node ;
private:
	Node * m_root ;
	int m_current ;
	Node * m_makeNode (const Item item) ;
	void m_print (const Node & node) ;
	Node * m_leftmostOrRightmostNode (Node * const pNode, const direction directionComeFrom) ;
	void m_removeAll (Node * pNode) ;
public:
	binarySearchTree (void) ;
	bool isEmpty (void) ;
	bool insert (const Item item) ;
	bool remove (const Item item) ;
	void print (void) ;
	//	If you called becomeToATwoWayCirculationLinkedListAndPrintItAndEmptyTheTree()
	//	will change the tree to a two way circulation linked list and print all the elements in diminsihing order and increment order,
	//	and empty the tree at last.
	void becomeToATwoWayCirculationLinkedListAndPrintItAndEmptyTheTree (const direction headDirection) ;
	~binarySearchTree (void) ;
} ;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值