15填空请阅读下面一段代码PleasereadthefollowingcodeC++:Python:
15填空请阅读下面一段代码PleasereadthefollowingcodeC++:Python:若此段代码的作用是用来进行中序遍历,那么应该在几号访问点进行访问?(只需要填写数字)ifthiscodeisusedtodoaninfixordertraversal,whichvisitingpointshouldbevisited?(Youonlyneedtowritedownthenumber)
16填空请阅读下面一段代码PleasereadthefollowingcodeC++:Python:若此段代码的作用是用来进行后序遍历,那么应该在几号访问点进行访问?(只需要填写数字)ifthiscodeisusedtodoanpostordertraversal,whichvisitingpointshouldbevisited?(Youonlyneedtowritedownthenumber)
1多选下列关于二叉树性质的说法正确的有:(多选)Whichsentencesofthefollowingsarerightaboutabinarytree’scharacterization:(Therearemorethanonecorrectanswers)

A.当一棵完全二叉树是满二叉树时,叶子结点不一定集中在最下面一层。Ifacompletebinarytreeisafullbinarytree,itwillbepossiblethatleafnodesisnotonthenethermostlayer.

B.一棵非空二叉树的为空的外部结点数目等于其结点数加1。Theamountofexternalnullnodesinabinarytreewithatleastonenodeequalstoitsamountofnodesplus1.

C.满二叉树的所有结点的度均为2。Alldegreesofnodesinafullbinarytreeare2.

D.非空满二叉树的结点个数一定为奇数个。Theamountofnodesofafullbinarytreewithatleastonenodemustbeodd.

2多选下列关于二叉树遍历的说法正确的有:Whichsentencesofthefollowingsarerightabouttraversalofabinarytree:

A.所有结点右子树为空的二叉树的前序和后序遍历顺序恰好一样。Thesequencesofpreorderandpostorderofabinarytreewithallnodeswithoutleftchildtreearethesame.

B.所有结点左子树为空的二叉树的前序和中序遍历顺序恰好一样。Thesequencesofpreorderandinfixorderofabinarytreewithallnodeswithoutleftchildtreearethesame.

C.存在一棵非空二叉树,它的前序、中序和后序遍历都是一样的。Thereexistsabinarytreewithatleastonenode,whosepreorder,infixorderandpostorderareallthesame.

D.所有结点右子树为空的二叉树的中序和后序遍历顺序恰好一样。Thesequencesofinfixorderandpostorderofabinarytreewithallnodeswithoutrightchildtreearethesame.

3填空一棵有510个结点的完全二叉树的高度为多少?(独根树高度为1)Whatistheheightofacompletebinarytreewith510nodes?(theheightofatreewithonlyarootis1)

数据结构与算法

北京大学

军职在线答案

大学网课

«
»

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注