前言:最近快到FDS考试了,po重刷了一下学校的题目,自己整理了一些解析orz 因为po在自己找解析和学习的过程中非常痛苦,所以在此共享一下我的题目和自己写的解题思路,欢迎各位指出错误~全章节预计会陆续更新,可在专栏查看~
HW5
1.In a binary search tree, the keys on the same level from left to right must be in sorted (non-decreasing) order.
T
2.In a binary search tree which contains several integer keys including 4, 5, and 6, if 4 and 6 are on the same level, then 5 must be their parent.
F;4和6可能不是同一个parent的两个child,可能4是rchild,6是lchild
3. Given a binary search tree as shown in the following figure. Which of the following relationships is correct with respect to the given tree?
1<3<5<4<2;遵循左子树小,右子树大的原则
4.Given the structure of a binary search tree (as shown in the figure), which one of the following insertion sequences is impossible?
A.83 67 91 98 20 75
B.83 67 75 91 20 98
C.83 91 75 67 20 98
D.83 91 98 67 75 20
C;按顺序画图即可
5.Given a binary search tree with its preorder traversal sequence { 8, 2, 15, 10, 12, 21 }. If 8 is deleted from the tree, which one of the following statements is FALSE?
A.One possible preorder traversal sequence of the resulting tree may be { 2, 15, 10, 12, 21 }
B.One possible preorder traversal sequence of the resulting tree may be { 10, 2, 15, 12, 21 }
C.One possible preorder traversal sequence of the resulting tree may be { 15, 10, 2, 12, 21 }
D.It is possible that the new root may have 2 children
C;删除搜索二叉树,需要用中序遍历的前驱或后继替代根节点,对应AB两种情况
6.Insert {5, 2, 7, 3, 4, 1, 6} one by one into an initially empty binary search tree. The postorder traversal sequence of the resulting tree is:
A.1, 2, 3, 4, 6, 7, 5
B.1, 4, 2, 6, 3, 7, 5
C.1, 4, 3, 2, 6, 7, 5
D.5, 4, 3, 7, 6, 2, 1
C;注意问的是后序遍历结果
7.Among the following binary trees, which one can possibly be the decision tree (the external nodes are excluded) for binary search?
A 这道题目我看了好久,可以通过根节点左右子树大小判断mid取大还是取小,比如A选项这张图左子树5个节点右子树4个节点,那mid是(left+right)/2+1(取大);同时叶结点只会往同一侧偏(因为取大还是取小整棵树应该统一)
8. For a binary search tree, in which order of traversal that we can obtain a non-decreasing sequence?
A.preorder traversal
B.postorder traversal
C.inorder traversal
D.level-order traversal文章来源:https://www.toymoban.com/news/detail-845034.html
C;中序顺序得到的就是按顺序排列结果。文章来源地址https://www.toymoban.com/news/detail-845034.html
到了这里,关于数据结构英文习题解析-第五章 二叉搜索树Binary Search Tree的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!