【PTA】【数据结构与算法】B-树和B+树

判断题

1.m阶B树的根结点最多有m棵子树。
TF
2.In a B+ tree, leaves and nonleaf nodes have some key values in common.
TF
3.A 2-3 tree with 12 leaves may have at most 10 nonleaf nodes.
TF

选择题

1.Among the following statements, which one does NOT satisfy the definition of a B tree of order m?
选项
AAll the leaf nodes are linked by pointers
BThe root has at most m subtrees
CAll the leaf nodes are on the same level
DInside each node, the keys are arranged in sorted order
2.B+树不同于B树的特点之一是:
选项
A能支持顺序查找
B结点中含有关键字
C根结点至少有两个分支
D所有叶结点都在同一层上
3.After deleting 9 from the 2-3 tree given in the figure, which one of the following statements is FALSE?

在这里插入图片描述

选项
Athe root is full
Bthe second key stored in the root is 6
C6 and 8 are in the same node
D6 and 5 are in the same node
4.Which of the following statements concerning a B+ tree of order M is TRUE?
选项
Athe root always has between 2 and M children
Bnot all leaves are at the same depth
Cleaves and nonleaf nodes have some key values in common
Dall nonleaf nodes have between ⌈M/2⌉ and M children
5.A B+ tree of order 3 with 21 numbers has at most __ nodes of degree 3.
选项
A1
B2
C3
D4
6.一棵有21个数字的、度为3的B+树最少有 __ 个度为2的结点。
选项
A0
B1
C2
D3
7.Which one of the following is NOT true about B+ trees and AVL trees: they are both __。
选项
Abalanced binary trees
Bfit for sequential searches
Cfit for random searches
Dfit for range searches
8.Given a 2-3 tree as shown in the figure, after inserting 7 with splitting strategy, what is (are) the key(s) in the root?

在这里插入图片描述

选项
A4
B 6
C8
D4 and 6
9.Given a 2-3 tree as shown in the figure, after inserting 18 with splitting strategy, where will the key 15 be?

在这里插入图片描述

选项
Ain the root alone
B in the root with key 20
Calone in a node on the second level (the leaves are on the first level)
Din a node with key 11 on the second level (the leaves are on the first level)
10.The minimum number of keys in a B tree with order 3 and height 5 is __.
选项
A15
B 31
C62
D242
11.After inserting 0 into the 2-3 tree given in the figure, how many of the following statements are FALSE?

在这里插入图片描述

(S1) The tree grows higher;

(S2) 2 and 4 are in the same interior node;

(S3) the root node still contains 9 only;

(S4) the interior node containing 12 keeps unchanged.
选项
A0
B 1
C2
D3
12.下面关于B-和B+树的叙述中,不正确的是( )。
选项
AB-树和B+树都是平衡的多叉树
BB-树和B+树都可用于文件的索引结构
CB-树和B+树都能有效地支持顺序检索
DB-树和B+树都能有效地支持随机检索
13.m阶B-树是一棵( )。
选项
Am叉排序树
B m叉平衡排序树
Cm-1叉平衡排序树
Dm+1叉平衡排序树
### 关于 PTA 平台上的邻接矩阵解题思路 在PTA平台上涉及的数据结构算法题目中,当遇到基于邻接矩阵的问题时,理解其基本概念操作至关重要。邻接矩阵是一种通过二维数组表示图的方式,在有向图中该矩阵的元素指示从一个节点指向另一节点是否存在边;而在无向图里,则表现为对称性质的矩阵[^1]。 针对具体的应用场景,比如进行深度优先遍历(DFS),需要注意的是连接性的判定条件应依据`Graph->G[V][i] == 1`而非`Graph->G[V][i] != INFINITY`来进行判断,这是因为实际测试案例中的未连通节点间并非被赋予无穷大(INFINITY)值而是默认为0或其他特定数值[^2]。 对于某些复杂度较高的问题求解过程,如最短路径计算,可以考虑使用弗洛伊德(Floyd)算法。此方法的核心在于迭代更新每一对顶点间的最小距离,其中特别强调了三重循环内部次序的重要性——即将中间节点置于最外部循环位置以确保所有可能路径都被考虑到: ```cpp for (int k = 1; k <= N; ++k) for (int i = 1; i <= N; ++i){ for (int j = 1; j <= N; ++j){ if (k == i || k == j || i == j) continue; if (length[i][j] > length[i][k] + length[k][j]) length[i][j] = length[i][k] + length[k][j]; } } ``` 此外,在构建具体的邻接矩阵实例方面,假设存在由a, b, c, d组成的四个顶点以及它们之间的四条无向边<a,b>,<b,c>,<c,d>,<d,a>,那么相应的邻接矩阵将会呈现出如下特点:除了上述提到的这些成对出现的位置设置为1之外,其余部分保持初始状态(通常设为0),以此反映各节点间的直接可达情况[^5]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值