B+ TREE
PRESENTED BY
M.RAMYA
Msc[CS&IT]
NADAR SARASWATHI COLLEGE OF ARTS &SCIENCE,
VADAPUDUPATTI , THENI.
INTRODUCTION
• B+ tree is a (key, value) storage method in a tree like structure.
B+ tree has one root, any number of intermediary nodes
(usually one) and a leaf node.
• Here all leaf nodes will have the actual records stored.
Intermediary nodes will have only pointers to the leaf nodes; it
not has any data.
• Any node will have only two leaves. This is the basic of any
B+ tree.
STRUCTURE OF B+ TREE
• A B+ tree index is a multilevel indexes , but it has a structure
that differs from than of the multilevel index-sequential file.
• The bucket structure is used only if the search key does not
from a primary key and if the file is not sorted in the search key
value in the order.
QUERIES ON B+ TREE
• Process queries using a b+ tree . To find all the records with a search-key
value of k.
• Leaf nodes must have between 2 and 4 values([(n-1)/2)] and n-
1 , with n=5).
• Non-leaf nodes other than root must have between 3 and 5
children([(n/2)]and n with n=5).
• Root must have at least 2 children.
UPADATES ON B+ TREES
INSERTION
If the search key value already appears in the leaf node , we add the new
record to the file and , if necessary , a pointer to the bucket.
DELETION
Using same technique as for lookup , we find the record to be deleted and
remove it from the file . The search key value is removed from the leaf
node if there is no bucket associated with that search key value or if the
bucket becomes empty as a result of the deletion.
B+TREE FILE ORGANIZATION
In a B+ tree file organization , the leaf nodes of the
tree store records instead of storing pointers to
records . An example of a B+ tree file organization .
Since records are usually larger than pointers , the
maximum number of records that can be stored in
the leaf nodes is less than the number of pointers in
a non leaf node.
MAIN GOAL OF B+ TREE IS:
• Sorted Intermediary and leaf nodes
Since it is a balanced tree, all nodes should be sorted.
• Fast traversal and Quick Search
Any record should be fetched very quickly. This is made by maintaining the
balance in the tree and keeping all the nodes at same distance
• No overflow pages
B+ tree allows all the intermediary and leaf nodes to be partially filled – it will have
some percentage defined while designing a B+ tree. In our example above,
intermediary node with 108 is underflow. And leaf nodes are not partially filled,
hence it is an overflow. In ideal B+ tree, it should not have overflow or underflow
except root node.
B+ tree

B+ tree

  • 1.
    B+ TREE PRESENTED BY M.RAMYA Msc[CS&IT] NADARSARASWATHI COLLEGE OF ARTS &SCIENCE, VADAPUDUPATTI , THENI.
  • 2.
    INTRODUCTION • B+ treeis a (key, value) storage method in a tree like structure. B+ tree has one root, any number of intermediary nodes (usually one) and a leaf node. • Here all leaf nodes will have the actual records stored. Intermediary nodes will have only pointers to the leaf nodes; it not has any data. • Any node will have only two leaves. This is the basic of any B+ tree.
  • 3.
    STRUCTURE OF B+TREE • A B+ tree index is a multilevel indexes , but it has a structure that differs from than of the multilevel index-sequential file. • The bucket structure is used only if the search key does not from a primary key and if the file is not sorted in the search key value in the order.
  • 5.
    QUERIES ON B+TREE • Process queries using a b+ tree . To find all the records with a search-key value of k.
  • 6.
    • Leaf nodesmust have between 2 and 4 values([(n-1)/2)] and n- 1 , with n=5). • Non-leaf nodes other than root must have between 3 and 5 children([(n/2)]and n with n=5). • Root must have at least 2 children.
  • 7.
    UPADATES ON B+TREES INSERTION If the search key value already appears in the leaf node , we add the new record to the file and , if necessary , a pointer to the bucket.
  • 8.
    DELETION Using same techniqueas for lookup , we find the record to be deleted and remove it from the file . The search key value is removed from the leaf node if there is no bucket associated with that search key value or if the bucket becomes empty as a result of the deletion.
  • 9.
    B+TREE FILE ORGANIZATION Ina B+ tree file organization , the leaf nodes of the tree store records instead of storing pointers to records . An example of a B+ tree file organization . Since records are usually larger than pointers , the maximum number of records that can be stored in the leaf nodes is less than the number of pointers in a non leaf node.
  • 11.
    MAIN GOAL OFB+ TREE IS: • Sorted Intermediary and leaf nodes Since it is a balanced tree, all nodes should be sorted. • Fast traversal and Quick Search Any record should be fetched very quickly. This is made by maintaining the balance in the tree and keeping all the nodes at same distance • No overflow pages B+ tree allows all the intermediary and leaf nodes to be partially filled – it will have some percentage defined while designing a B+ tree. In our example above, intermediary node with 108 is underflow. And leaf nodes are not partially filled, hence it is an overflow. In ideal B+ tree, it should not have overflow or underflow except root node.