14填空一棵完全三叉树,下标为120的结点在第几层?(注:下标号从0开始,根的层数为0)Inacomplete3-arytree,whatlevelisthenode,whosesubscriptis120,standon?(P.S.thesubscriptstartsform0,andthelevelofrootnodeis0)
15填空根据树的双标记层次遍历序列,求其带度数的后根遍历序列Giventhedouble-tagginglevel-ordertraversalsequenceofatree,pleasewritedownthepost-ordertraversalsequencewithdegree.比如:已知一棵树的双标记层次遍历序列如下:Forexample,assumethatatree’sdouble-tagginglevel-ordertraversalsequenceisshownasfollowed:
16填空根据树的双标记层次遍历序列,求其带度数的后根遍历序列Giventhedouble-tagginglevel-ordertraversalsequenceofatree,pleasewritedownthepost-ordertraversalsequencewithdegree.比如:已知一棵树的双标记层次遍历序列如下:Forexample,assumethatatree’sdouble-tagginglevel-ordertraversalsequenceisshownasfollowed:
17填空根据树的双标记层次遍历序列,求其带度数的后根遍历序列Giventhedouble-tagginglevel-ordertraversalsequenceofatree,pleasewritedownthepost-ordertraversalsequencewithdegree.
18填空对于以下等价类,采用“加权合并规则”(也称“重量权衡合并规则”),进行并查运算,给出最后父节点索引序列。Forthefollowingequivalenceclass,pleaseuse”weightedunionrule”andUNION/FINDalgorithmtowritedownthefinalparentnodeindexsequence.4-06-28-49-43-59-55-21-27-1注意:当合并大小相同的两棵树的时候,将第二棵树的根指向第一棵树的根;根节点的索引是它本身;数字之间用空格隔开。Notice:Whenwejointwotreeswiththesamesize,welettherootofthesecondtreepointtotherootofthefirsttree.Theindexoftherootnodeisitself.Separatethenumberswithonlyonespaces.
数据结构与算法
北京大学
军职在线答案
大学网课