b树中的m到底是什么_什么是B树?

b树中的m到底是什么

B-tree is another very popular search tree.
The node in a binary tree like AVL tree contains only one record. AVL tree is
commonly stored in primary memory. In database application, where huge volume
of data is handled, the search tree cannot be accommodated in primary memory.
B-trees are primarily meant for secondary storage.
A B-tree is a M-way tree. An M-way tree can
have maximum of M children.
An M-way tree contains multiple keys in a
node. This leads to reduction in overall height of the tree. If a node of M-way
tree holds K number of keys then it will have K+1 children.

Definition

A B-tree of order M is a M-way search tree
with the following properties:
1. The root can have 1 to M-1 keys.
2. All nodes (except the root) have between [(M-1)/2]
and M-1 keys.
3. All leaves are at the same depth.
4. If a node has t number of children then
it must have (t-1) number of keys.
5. Keys of a node are sorted in ascending
order.
6. K0, K1, K2
. . . Kn-1 are the keys stored in the node. Subtrees are pointed by
P0, P1 . . . Pn then K0>= all
keys of the subtree P1
               .
               .
               .
               .
Kn-1 >= all keys of the
subtree Pn-1
Kn-1 < all keys of the
subtree Pn
An example of B-tree
of order 4 is shown below:

Representation of a node of B-tree

# define MAX 5
struct node;
struct pair
{
               node
*next;
               int
key;
};
struct node
{
               node
*first;
               node
*father;
               pair
data [MAX];
               int
noofkeys;
};
  • Structure pair is being used to combine a

    key and the associated tree pointer.

  • Class node can store a maximum of MAX pairs

    of (key, next). A node with MAX number of keys will give rise to MAX + 1 ways.

    The additional tree pointer is designated as ‘first’.

  • ‘nooofkeys’ gives the actual number of keys

    stored in a node.

  • The pointer ‘father’ points to the father

    of a node. ‘father’ pointer will be NULL for the root node.

Please share this article if you like it. If you find anything incorrect or missing above then mention it by commenting below.

翻译自: https://www.thecrazyprogrammer.com/2014/03/what-are-b-trees.html

b树中的m到底是什么

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值