介绍B树之前,先介绍树的几个概念。
Degree
The number of subtrees of a node.
Height of node
The height of a node is the number of edges on the longest path between that node and a leaf.
Height of tree
The height of a tree is the height of its root node.
Depth
The depth of a node is the number of edges from the tree's root node to the node.
定义
A B-Tree is defined by the term minimum degree ‘t’. The value of t depends upon disk block size.
- Every node except root must contain at least t-1 keys. Root may contain minimum 1 key.
- All nodes (including root) may contain at most 2t – 1 keys.
- Number of children of a node is equal to the number of keys in it plus 1.
- All keys of a node are sorted in increasing order.
- All leaves are at same level.
另一种定义方式
4阶B树又叫2-3-4树,3阶B树又叫2-3树。
参考资料:
https://en.wikipedia.org/wiki/Tree_(data_structure)
https://en.wikipedia.org/wiki/B-tree#Definition