正在加载图片...
virtual int Insert(( const Type&item)/插入值为item的新结点 virtual int find( const Type&item) const/查找值为item的结点 const Bin TreeNode< Type>* Getroot() const{ return root;}/求根结点的指针 friend istream operator >> istream in, BinTreeNode<Type>& Tree ∥重载操作:输入数据元素并建立一棵二叉树Tree friend ostream operator << ostream out, Bin Tree Node<Type> tree ); ∥重载操作:输出一棵二叉树Tro Private BinTreeNode<Type>*root/根结点指针 Type Ref value;/数据输入结束标志,仅用于输入 BinTreeNode<Type>* Parent( BinTreeNode<Type> x start BinTreeNode<type>*current /)求 start树中* current结点的父结点指针 int Insert( BinTreeNode<Type>*& current, const Type item ) / current树中插入值为item的新结点 void Traverse ( Bin Tree Node<Type> current ostream out)const )历输出 current二叉树 int Find( BinTreeNode<Type>* current, const Type item)const current树中查找值为item的结点 void destroy(( binTreeNode<Type> s current /删除 current树的所有结点 20212222021/2/22 9 virtual int Insert( const Type & item );//插入值为 item 的新结点 virtual int Find( const Type & item ) const ;//查找值为 item 的结点 const BinTreeNode<Type> * GetRoot( ) const { return root ; } //求根结点的指针 friend istream & operator >> ( istream & in , BinTreeNode<Type> & Tree ); //重载操作:输入数据元素并建立一棵二叉树 Tree friend ostream & operator << ( ostream & out , BinTreeNode<Type> & Tree ) ; //重载操作:输出一棵二叉树Tree Private: BinTreeNode<Type> * root;//根结点指针 Type RefValue;//数据输入结束标志,仅用于输入 BinTreeNode<Type> * Parent( BinTreeNode<Type> * start, BinTreeNode<Type> * current ); //求 start 树中 *current 结点的父结点指针 int Insert( BinTreeNode<Type> * & current, const Type & item ); //在 current 树中插入值为 item 的新结点 void Traverse(BinTreeNode<Type> * current ,ostream & out ) const; //遍历输出 current 二叉树 int Find ( BinTreeNode<Type> * current, const Type & item ) const ; //在 current 树中查找值为 item 的结点 void destroy(( BinTreeNode<Type> * current ); //删除 current 树的所有结点 }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有