 # B-Tree Example In Data Structure.

Hello Friends, In this blog post I am going to let you know about the B-Tree in Data Structure. B-Tree of order n is a balanced multiway search tree of order n, In which each nonroot node contains at least (n-1)/2 keys.

Note that the slash denotes integer division so that a B-Tree of order 12 contains at least 5 keys in each nonroot nod, as does a B-Tree or order 11).

A B-Tree or order n is also called an n-(n-1) tree or an (n-1)-n tree. This means that each node in the tree has (n-1) maximum keys and n sons. The reason for using this second technique is,……….

that it creates balanced trees so that the maximum number of nodes accessed to find any particular key is kept small,…….

and another reason is that all nodes(except for the root) in a tree created by this technique are at least half full, so that very little storage space is wasted,…..

some terminology different in B-Tree. Such as order and degree are differently defined by different authors.

Order:

Order of a B-Tree defined as the minimum number of keys in a nonroot node(that is (n-1)/2)

Degree:

The degree of a B-Tree is the maximum number of sons(i,e.,n). Still other authors use ‘order’ to mean the maximum number of keys in a node.

Example of B-Tree:

We have to insert the following keys into B-tree of order 5 step by step:

1,7,6,2,11,4,8,13,10,5,19,9,18,24,3,12,14,20,21,16

Now we start inserting the given data into a B-Tree of order 5 (that means the maximum number of keys = 4). The whole process is given below.