0% found this document useful (0 votes)
21 views2 pages

BTree BPlusTree Theory Summary Final

B-Trees are self-balancing tree data structures that store sorted data and allow logarithmic time for insertion, deletion, and searching, commonly used in file systems and databases. B+ Trees extend B-Trees by storing all data in leaf nodes, improving efficiency for large block reads and range queries. The choice between B-Trees and B+ Trees depends on the use case, with B-Trees suited for general operations and B+ Trees optimized for indexing and fast queries.

Uploaded by

SSudhirAvinesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views2 pages

BTree BPlusTree Theory Summary Final

B-Trees are self-balancing tree data structures that store sorted data and allow logarithmic time for insertion, deletion, and searching, commonly used in file systems and databases. B+ Trees extend B-Trees by storing all data in leaf nodes, improving efficiency for large block reads and range queries. The choice between B-Trees and B+ Trees depends on the use case, with B-Trees suited for general operations and B+ Trees optimized for indexing and fast queries.

Uploaded by

SSudhirAvinesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Understanding B-Trees and B+ Trees

B-TREE - Theory Summary

Definition:

A B-Tree is a self-balancing tree data structure used for storing sorted data. It enables logarithmic time for insertion,

deletion, and searching. It is commonly used in file systems and databases.

Key Properties of a B-Tree of order t:

1. Each node contains a maximum of 2t - 1 keys.

2. Each node contains a minimum of t - 1 keys, except the root.

3. A node with n keys has n + 1 children.

4. All leaf nodes appear at the same level.

5. Keys are maintained in sorted order.

6. The root may have fewer than t - 1 keys.

Operations in B-Tree:

- Search: Start from the root, use binary search in each node, and proceed to children if needed.

- Insertion: If the node is full, split it. Promote the middle key to the parent and continue inserting in the correct child.

- Deletion: Delete from the leaf. If a node falls below minimum keys, borrow from sibling or merge with sibling.

Use Cases: File systems, general-purpose storage structures, in-memory databases.

B+ TREE - Theory Summary

Definition:

A B+ Tree is an extension of the B-Tree that stores all data only in the leaf nodes, while internal nodes serve only as

routing indexes. It is designed for systems that read and write large blocks of data efficiently.

Key Properties:

1. Internal nodes contain only keys, no actual data.

2. Leaf nodes contain the actual data and are linked together using pointers.

3. All leaves are at the same level.

4. Faster for range queries due to linked leaves.


Understanding B-Trees and B+ Trees

5. Keeps data in sorted order in the leaves.

6. Search always ends at a leaf node.

Operations in B+ Tree:

- Search: Traverse from root to leaf. Always ends at a leaf node where actual data is found.

- Insertion: Insert into a leaf node. If it overflows, split the leaf. Propagate changes upward if necessary.

- Deletion: Remove from the leaf. If underflow occurs, borrow from or merge with neighboring nodes.

Use Cases: Databases like MySQL, large-scale indexing systems, file systems.

B-TREE vs B+ TREE - Comparison Table

| Feature | B-Tree | B+ Tree |

|-----------------------|-------------------------------|-------------------------------------|

| Data Location | Stored in all nodes | Stored only in leaf nodes |

| Internal Nodes | Contain both keys and data | Contain only keys |

| Leaf Node Linking | Not linked | Linked for fast range traversal |

| Search Path | May end in internal node | Always ends in leaf node |

| Range Queries | Slower | Faster due to linked leaf nodes |

| Use Cases | File systems, in-memory DBs | Database indexing, disk-based DBs |

Summary

- Use B-Tree for general-purpose balanced tree operations.

- Use B+ Tree for high-performance indexing and fast range queries, especially on disk-based systems.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy