A B-tree used as an index for a large database table has four levels including the root node. If a new key is inserted in this index, then maximum number of nodes that could be newly created in the process is
5
This question asks about the maximum number of new nodes that can be created when inserting a key into a B-tree used as a database index. The B-tree has four levels, including the root.
A B-tree is a self-balancing tree data structure that maintains sorted data and allows searches, sequential access, insertions, and deletions in logarithmic time. It is commonly used in databases and file systems.
The levels are typically counted starting from the root as Level 1. So, a four-level tree has:
Inserting a new key in a B-tree starts by searching for the leaf node where the key should be placed based on its value.
Once the correct leaf node is found, the key is inserted into it.
If the leaf node has space (is not full), the insertion is simple, and no new nodes are created.
If the leaf node is full, it must split. A split involves:
The maximum number of new nodes is created when a split propagates all the way up from a leaf node to the root node. This happens when the leaf node is full, its parent is full, the parent's parent is full, and so on, all the way up to the root.
Let's trace the process in a 4-level tree where every node on the insertion path is full:
In this scenario, where the split propagates from the leaf all the way to the root causing the root to split, the maximum number of new nodes created is 5.
Let's summarise the maximum new nodes created at each level during this maximum propagation:
| Level | Event | New Nodes Created in this Step |
|---|---|---|
| 4 (Leaf) | Split | 1 |
| 3 | Split | 1 |
| 2 | Split | 1 |
| 1 (Root) | Split | 2 (New root + right half of old root) |
| Total Maximum New Nodes | ${1 + 1 + 1 + 2 = 5}$ | |
| Concept | Description |
|---|---|
| B-tree | A self-balancing tree for efficient disk access. |
| Node | Contains keys and pointers to child nodes. |
| Root Node | The top node of the tree (Level 1). |
| Leaf Node | Nodes at the bottom of the tree containing keys but no pointers to children within the B-tree structure itself (they point to data records). |
| Splitting | When a node is full and a new key/pointer needs to be added, the node is split into two, and a key is promoted to the parent. |
| Propagation | When a split causes the parent node to become full and also split, this is split propagation. |
The minimum and maximum number of keys a B-tree node can hold is determined by the tree's order (or minimum degree). If the order is $m$, a node (except the root) must have at least $m-1$ keys and $m$ pointers, and at most $2m-1$ keys and $2m$ pointers. The root can have fewer keys (at least 1, unless the tree is empty).
Insertion always happens at a leaf node. The search path for insertion goes from the root down to the appropriate leaf.
Node splitting is the mechanism that keeps the B-tree balanced and ensures search operations remain efficient (logarithmic time complexity).
While splitting increases the number of nodes, it also maintains the tree's structure, preventing it from becoming skewed like a simple binary search tree might with unbalanced insertions.
In some cases, insertion might not require any splits if the leaf node has space, or splits might stop propagating if a parent node is not full. The question asks for the maximum number of newly created nodes, which occurs only during full propagation to the root.
Primary index in sequential order file organisation is also known as ______.
The total cost of retrieving records in sorted order using an unclustered B+ tree is
(P-Average number of records per data page
N-Data pages
F-Ratio of the size of a data entry to the size of a data record)
Consider a B+ Tree where the maximum number of key values in each leaf node is 2 and the maximum number of pointers in each non-leaf node is 3. Let the content of the B+ Tree be as shown in the figure.
Which of the following options denotes the key value(s) stored in the root node after inserting a key value 3 in the given B+ Tree?

An OTT company is maintaining a large disk-based relational database of different movies with the following schema:
Movie(ID, CustomerRating)
Genre(ID, Name)
Movie_Genre(MovieID, GenreID)
Consider the following SQL query on the relation database above:
SELECT *
FROM Movie, Genre, Movie_Genre
WHERE
Movie.CustomerRating > 3.4 AND
Genre.Name = “Comedy” AND
Movie_Genre.MovieID = Movie.ID AND
Movie_Genre.GenreID = Genre.ID;
This SQL query can be sped up using which of the following indexing options?