Introduction of B+ Tree (original) (raw)

Last Updated : 18 Apr, 2026

A B+ Tree is an advanced data structure used in database systems and file systems to maintain sorted data for fast retrieval, especially from disk. It is an extended version of the B Tree, where all actual data is stored only in the leaf nodes, while internal nodes contain only keys for navigation.

Components of B+ Tree

This structure makes the B+ Tree balanced, disk-efficient, and ideal for database indexing.

Features of B+ Trees

How B+ Trees Work

The Structure of the Internal Nodes of a B+ Tree of Order 'a' is as Follows

Structure of  Internal Node

Structure of Internal Node

The Structure of the Leaf Nodes of a B+ Tree of Order 'b' is as Follows

Structure of Lead Node

Structure of Leaf Node

In the below diagram, we can see that using the Pnext pointer it is viable to traverse all the leaf nodes, just like a linked list, thereby achieving ordered access to the records stored in the disk.

Tree Pointer

Tree Pointer

Searching a Record in B+ Trees

To search for a key:

  1. Start at the root node
  2. Navigate through internal nodes based on key comparisons
  3. Reach the appropriate leaf node
  4. If the key exists, return the data; otherwise, report "record not found"

**Example: In the image below, in order to search for 58, traverse the root → internal node → reach the correct leaf node that contains 58 (if it exists).

frame_281

B+ tree

Insertion in B+ Trees

Insertion in B+ Trees is done in three steps:

1. Navigate to the correct leaf node
2. Insert the new key in sorted order

3. If overflow occurs:

For more, refer to Insertion in a B+ Trees.

Deletion in B+Trees

Deletion involves:

1. Finding and removing the key from the appropriate leaf node

2. Rebalancing the tree to maintain B+ Tree properties:

For more, refer to Deletion in B+ Trees.

Difference Between B+ Tree and B Tree

Some differences between B+ Tree and B Tree are stated below.

Parameters B+ Tree B Tree
**Structure Separate leaf nodes for data storage and internal nodes for indexing Nodes store both keys and data values
**Leaf Nodes Leaf nodes form a linked list for efficient range-based queries Leaf nodes do not form a linked list
**Order Higher order (more keys) Lower order (fewer keys)
**Key Duplication Typically allows key duplication in leaf nodes Usually does not allow key duplication
**Disk Access Better disk access due to sequential reads in a linked list structure More disk I/O due to non-sequential reads in internal nodes
**Applications Database systems, file systems, where range queries are common In-memory data structures, databases, general-purpose use
Performance Better performance for range queries and bulk data retrieval Balanced performance for search, insert, and delete operations
**Memory Usage Requires more memory for internal nodes Requires less memory as keys and values are stored in the same node

Advantages

Disadvantages