正在加载图片...
template<class Entry> 递归建立 void Binary tree<Entry>: CreatBinary th 根结点指 I CreatBinary tree( root);) 表示建立根结点 的右子树 template<class Entry> ora Binary_tree ntry 立二叉链表 表示的二叉树 CreatBinary_ tree(Binary_nodesericry>*&rl f cin>>x; if(x==endmark )r=NULL else r= new RiMary_Node<Entr(x Create ar tree(r->left) CreatIn. y right); Entry 表示“空的 data member 数据template<class Entry> void Binary_tree<Entry>::CreatBinary_tree() { CreatBinary_tree(root); } template<class Entry> void Binary_tree<Entry>:: CreatBinary_tree(Binary_node<Entry>* &r) { cin>>x; if ( x==endmark ) r = NULL; else{ r = new Binary_Node<Entry>(x); CreatBinary_tree(r->left); CreatBinary_tree(r->right); } } 建立二叉链表 表示的二叉树 递归建立以r为 根结点指针的二叉链表 表示的二叉树 建立”空”二叉树 建立根结点 的左子树 的右子树 Entry data member 表示‘空’的 数据
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有