数据结构之B树: B-tree

wiki

对于B-tree,并没有一个明确的定义. 依据规则,大致可以按照 最重要参数 - order的不同解释,分为两种

1. Bayer & McCreigt 1972

用 order 规定每个节点容纳的键值数量
d :order
h : depth ,深度,树高
k : 节点的 健值数
N : 一棵 B-tree 能储存的总键值

  • 对于跟节点, 1 <= k <= 2d
  • 对于其他的普通节点: d <= k <= 2d
  • 一个非叶 节点,有 k+1个子节点
  • 2(d+1)^h -1 <= N <= (2d + 1)^(h+1) - 1

2. Knuth 1998

用 order 规定每个非叶节点能引申的子节点数量。这个更为常见一些。

According to Knuth's definition, a B-tree of order m is a tree which satisfies the following properties:

  • Every node has at most m children.
  • Every non-leaf node (except root) has at least ⌈m⁄2⌉ children.
  • The root has at least two children if it is not a leaf node.
  • A non-leaf node with k children contains k−1 keys.
  • All leaves appear in the same level

你可能感兴趣的:(数据结构之B树: B-tree)