关闭

B+树 习题解

标签: B+树习题解算法高级数据结构
798人阅读 评论(0) 收藏 举报
分类:

B+树是一种n叉树,它将所有数据存在一个level中。B+ 树的特点是能够保持数据稳定有序,其插入与修改拥有较稳定的对数时间复杂度。因此B+树被应用于数据库和操作系统的文件系统中。
B+树的理解没有红黑树这么复杂,本文将首先简要介绍B+树,然后分析B+树的先关题目。本文重点是最后一部分。


介绍

A B+ tree of order M is a tree with the following structural properties:
(1) The root is either a leaf or has between 2 and M children.
(2) All nonleaf nodes (except the root) have between M/2 and M children.
(3) All leaves are at the same depth.
Assume each nonroot leaf also has between M/2 and M children.

需要注意:

  1. 每个存储数据的叶节点,其中的数据数量在M/2 与 M之间(闭区间)。若超出这个区间,则进行调整。
  2. 从空树开始时,数据首先存放在根节点中,当根节点的数据大于M时再进行调整。
  3. 根的子节点数最小为2, 而其他非根节点的子节点数最小为 M/2

相关题目

Insert 3, 1, 4, 5, 9, 2, 6, 8, 7, 0 into an initially empty 2-3 tree (with splitting). Which one of the following statements is FALSE? (2分)
A. 7 and 8 are in the same node
B. the parent of the node containing 5 has 3 children
C. the first key stored in the root is 6
D. there are 5 leaf nodes

解题过程

故选A

After deleting 9 from the 2-3 tree given in the figure, which one of the following statements is FALSE? (2分)
题目配图
A. the root is full
B. the second key stored in the root is 6
C. 6 and 8 are in the same node
D. 6 and 5 are in the same node

这里写图片描述

故选D

Which of the following statements concerning a B+ tree of order M is TRUE? (2分)
A. the root always has between 2 and M children
B. not all leaves are at the same depth
C. leaves and nonleaf nodes have some key values in common
D. all nonleaf nodes have between ⌈M/2⌉ and M children

A. 当只有root一个节点时,root没有孩子。故错。
B. 这违反了定义“所有叶节点位于同一深度”。
C. 正确。
D. 除了根节点外的非叶结点有 ⌈M/2⌉ 与 M 之间的子节点。
故选D

1
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:4876次
    • 积分:197
    • 等级:
    • 排名:千里之外
    • 原创:15篇
    • 转载:4篇
    • 译文:0篇
    • 评论:1条
    最新评论