.code { background:#f5f8fa; background-repeat:no-repeat; border: solid #5C7B90; border-width: 1px 1px 1px 20px; color: #000000; font: 13px 'Courier New', Courier, monospace; line-height: 16px; margin: 10px 0 10px 10px; max-height: 200px; min-height: 16px; overflow: auto; padding: 28px 10px 10px; width: 90%; } .code:hover { background-repeat:no-repeat; } .code { background:#f5f8fa; background-repeat:no-repeat; border: solid #5C7B90; border-width: 1px 1px 1px 20px; color: #000000; font: 13px 'Courier New', Courier, monospace; line-height: 16px; margin: 10px 0 10px 10px; min-height: 16px; overflow: auto; padding: 28px 10px 10px; width: 90%; } .code:hover { background-repeat:no-repeat; }

Friday, July 12, 2019

B+ Tree...

Examples for Insertion of data in to a B+ Tree


B+ tree is a rooted tree that consist of a root,internal nodes and leaves.In a B+ tree of order ( or branching factor) n should satisfy the following properties.

  • From root to leaf all the path's length should be same.
  • Each node that is not a root or a leaf has between (n/2) and n children. 
  • A leaf node has between ((n-1)/2) and n-1 values. 
  • If the root is not a leaf it has at least 2 children .
  • If the root is a leaf (there are no other nodes in the tree) it can have and 0 and (n-1) values.


Example 01-Enter numbers in to a B+ Tree

Branching factor-5
Number Sequence-5,10,15,20,25,30,35,40,50,55,65,70,75,80,90,95


Not a root or leaf has children between = (n/2) , n
                                                                  
                                                                   =(5/2), 5
             
                                                                   = 3,5

Leaf node has values between                =((n-1)/2) , (n-1)

                                                                  =(4/2), 4

                                                                  =2,4 










Example 02-Enter Strings to a B+ Tree

When you entering strings to a B+ tree you should consider the alphabetical order.

Branching factor=3

Colombo,Kandy,Galle,Badulla,Gampaha,Kottawa,Kalutara


Not a root or leaf has children between = (n/2) , n

                                                                   = 2, 3

Leaf node has values between                =((n-1)/2) , (n-1)

                                                                   = 1 , 2







Advantages of B+ Tree


  • Insertion, Deletion, Update does not affect to the performance since it is a balance tree structure.
  • Searching data is becomes more easy since all records are stored only in the leaf node.
  • Minimizing disk accesses by lowering the tree height due to large node fanout.
  • Keys are used for Indexing.

Disadvantages of B+ Tree


  • This method is less efficient for static tables.




By : Pramodi Samaratunga      -  University Of Moratuwa 

       Madhusanka Edirimanna  -  University Of Moratuwa 

1 comment:

SPRING MVC SIMPLE CRUD APPLICATION