B+ Tree

B+ Tree

  • A B+ tree is a type of balanced binary seek tree. It chases a multi-degree index layout.
  • Inside of the B+ tree, leaf nodes represent the actual information recommendations. B+ tree guarantees that everyone leaf nodes remain at the same top.
  • In the B+ tree, the leaf nodes have associated with the usage of a hyperlink listing. Consequently, a B+ tree can assist random get right of entry to similarly to sequential get right of admission.


Form of B+ Tree

  • Within the B+ tree, each leaf node is at an identical distance from the idea node. The B+ tree is of the order n in which n is steady for each B+ tree.
  • It consists of an inner node as well as a leaf node.

Inner node

  • An inner hub of the B+ tree can contain at slightest n/2 record pointers but the root node.
  • At most, an inside hub of the tree contains n pointers.

Leaf node

  • The leaf hub of the B+ tree can contain at slightest n/2 pointers of the record as well as n/2 values of key.
  • A leaf hub carries n number of record pointers and n quantity of key values.
  • Every leaf hub of the B+ tree contains one-piece pointer P to point the other leaf node.


Searching record in B+ Tree

Suppose we got to search fifty-five within the below B+ tree structure. To begin with, we are going fetch for the intermediary node which can coordinate to the leaf node that can contain a record for fifty-five. So, within the middle person hub, we’ll discover a department between fifty and seventy-five centers.

At that point at the conclusion, we are going be in the diversion to the third leaf hub. Here DBMS will perform a successive look to discover fifty-five.


Insertion of B+ Tree

Take that we need to embed a record sixty within the underneath structure. It’ll move to the third leaf hub after fifty-five. It could be an adjusted tree, and then a leaf hub of the tree is as of now full, hence we cannot embed sixty there.

Here, we need to part the leaf hub, so in that way it will be in the tree without influencing the fill to calculate, adjust, and arrange.

The 3rd leaf hub has the numbers (fifty, fifty-five, sixty, sixty-five, seventy) and its real root is fifty. We are going part the leaf hub of that tree within the middle so that it adjusts isn’t modified. We can gather the numbers (fifty, fifty-five) and the numbers (sixty, sixty-five, seventy) into the two nodes of the leaf.

If the two must be leaf hubs, the central hub cannot department from fifty. It ought to have sixty included to it, then after that able to have pointers towards an available leaf hub.

Usually how able to embed a section when there’s a problem. In an ordinary situation, it is straightforward to discover the hub where it gets fitted and after that put it in the leaf hub. 


Deletion of B+ Tree

Assume that we need to erase sixty from the cover illustration. Then, we need to expel sixty from the central hub also from the fourth leaf hub as well. On the off chance that we evacuate it from central hub, then it will not fulfill the run the show of B+ tree. We ought to alter it to get an adjusted tree. After erasing hub sixty from over B+ tree in changing the centers, it’ll appear as the following:

Please Share