B + 5 Tree
B + 5 Tree
➢ Contains root, internal nodes and leaf nodes like other Trees.
➢ If a target key value is less than the internal node, then the point just to its
left side is followed.
➢ If a target key value is greater than or equal to the internal node, then the
point just to its right side is followed.
➢ Copy the smallest search key value from second node to the
parent node.(Right biased)
Insertion B+ Tree
Ex. Inserting 8 into B+ Tree of order of 5:
Insertion B+ Tree
Case 2: Overflow in non-leaf node
➢ Split the non-leaf node into two nodes.
➢ If leaf page underflows, merge with sibling and delete key in between them.
➢ If index page underflows, merge with sibling and move down key in between them
1 4 7 10 7 9 20 25 28 31 42
Deletion in B+ Tree
New Index and
nodes will be like
this after deletion
20
25 ?
7 17 25 42
25 28 42
1 4 7 10 7 9 20 25 28 42
Where b = order
n = number of keys in the tree
Features of B+ Tree
Balanced: Self-balancing, means that as data is added or removed from the tree,
Multi-level: Multi-level data structures, with a root node at the top and one or more levels of internal
nodes below it. The leaf nodes at the bottom level contain the actual data.
Ordered: Maintain the order of the keys in the tree, which makes it easy to perform range queries
and other operations that require sorted data.
Fan-out: Have a high fan-out, means each node can have many child nodes, that reduces the height
of the tree and increases the efficiency of searching and indexing operations.
Cache-friendly: Designed to be cache-friendly, which means that they can take advantage of the
caching mechanisms to improve performance.
Disk-oriented: B+ Trees are often used for disk-based storage systems because they are efficient at
storing and retrieving data from disk.
THANKYOU