设二叉树以二叉链表方式存储 试完成下列问题的递归算法。 设二叉树结点和二叉树结构体定义如下: t

大学网课 已帮助 人

设二叉树以二叉链表方式存储,试完成下列问题的递归算法。 设二叉树结点和二叉树结构体定义如下: typedef struct btnode { ElemType element; struct btnode* lchild, *rchild; }BTNode; typedef struct binarytree{ BTNode* root; }BinaryTree; (1)求一棵二叉树的高度; int Depth(BTNode *p) { int lh, rh; if (!p) return 0; lh = ______________; rh = _____________; if (lh > rh) return _________; else return ________; } int DepthofBT(BinaryTree Bt) { return ___________; } (2)求一棵二叉树中的结点个数; int Size(BTNode * p) { if (!p)

设二叉树以二叉链表方式存储 试完成下列问题的递归算法。 设二叉树结点和二叉树结构体定义如下: t

热搜:二叉排序树的查找效率与二叉树的树形有关