假定一棵树的广义表表示为A(C,D(E,F,G),H(I,J)),则树中所含的结点数为__________个,树的深度
(1)树的根结点作为内子树构成的表的表名,放在表的最前面。
(2)每个结点的左子树和右子树用逗号隔开。若仅有在子树没有左子树,则逗号不能省略。
(3)在整个广义表表示输人的结尾加上一个特殊的符号(例如)表示输入结束。例如,对于如图5-26所示的二叉树,广义表表示为:A(B(D,E(G,)).C(,F))
B、a(b,c(d,e))
C、a(b(d),(e),c)
D、a(b,d(c),c)
A、(1) return 0;
B、(1) return 1;
C、(3) leftTreeHeight >= rightTreeHeight
D、(3) leftTreeHeight <= righttreeheight> E、(2) leftTreeHeight =depth(t->lchild)
F、(2) depth(t->lchild)
给出一棵树的逻辑结构T=(N,R),其中: N={A,B,C,D,E,F,G,H,I,J,K} R={r} r={(A,B),(B,E),(B,F),(F,G),(F,H),(A,C),(C,I),(C,J),(J,K),(A,D)} 试回答下列问题: Given a logical structure of a tree, T=(N, R), and N={A, B, C, D, E, F, G, H, I, J, K}, R={r}, r={(A,B), (B,E), (B,F), (F,G), (F,H), (A,C), (C,I), (C,J), (J,K), (A,D)} Please answer these questions: (1)哪个是F的父结点?which is the parent node of Node F? (2)哪些是B的子孙?which are the offspring of Node B? (3)以结点C为根的子树的深度是多少?what is the depth of the sub-tree whose root node is Node C? (注:根的层数为0,独根树深度为0,高度为1,其他题目同样如此;各个选项之间的答案用空格分隔就好;同一个选项的答案如果有多个字母,按照字典序排列,且不要以空格分隔) (P.S. the level of the root node is 0, the depth of a tree, which only has a root node, is 0, and its height is 1. Other problems have the same regulations. If there are several alphabets in one question, order them by lexicographical order, and do not add spaces.)
A.A
B.C
C.I
D.B
为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!