- Asked 2/14
- 2069 Bhadra · 6 marks
B-tree from 78, 21, 14, 11, 97, 85, 74, 63
Short answer
Assuming order 5, insert sequentially and split when a node holds 5 keys. Final tree: root [21 78] with leaf children [11 14], [63 74], [85 97].
Construct B-tree from the data set given by 78, 21, 14, 11, 97, 85, 74, 63 showing each insertion step.
The order is not given, so a B-tree of order 5 is assumed (at most 4 keys per node; a node splits when it receives a fifth key, and the median moves up).
Insertion steps (order 5)
| Step | Insert | Tree after step | Action |
|---|---|---|---|
| 1 | 78 | [78] | fits in leaf |
| 2 | 21 | [21 78] | fits in leaf |
| 3 | 14 | [14 21 78] | fits in leaf |
| 4 | 11 | [11 14 21 78] | fits in leaf |
| 5 | 97 | [21]{[11 14], [78 97]} | leaf [11 14 21 78 97] overflows, split: 21 moves up; new root |
| 6 | 85 | [21]{[11 14], [78 85 97]} | fits in leaf |
| 7 | 74 | [21]{[11 14], [74 78 85 97]} | fits in leaf |
| 8 | 63 | [21 78]{[11 14], [63 74], [85 97]} | leaf [63 74 78 85 97] overflows, split: 78 moves up |
Final B-tree
[21 78]
[11 14] [63 74] [85 97]
If order 3 is intended (at most 2 keys per node)
The final tree is:
[74]
[21] [85]
[11 14] [63] [78] [97]
Here a split happens whenever a node gets a third key. The tree has three levels because the root splits when the key 63 pushes 74 up.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- B-tree of order 5 for letters C N G A H ... · Data Structure and Algorithm, chapter 6 · asked 2×
- Heap tree insertion and heap sort · Data Structure and Algorithm, chapter 7
- B-tree properties; order 5 for 3, 14, 7, ... · Data Structure and Algorithm, chapter 6 · asked 2×
- B-tree insertion algorithm; AVL of months · Data Structure and Algorithm, chapter 6 · asked 2×
- AVL tree for 52, 65, 72, 15, 11, 32, 20 · Data Structure and Algorithm, chapter 6
- B-tree of order 5 for 82, 12, 22, ... · Data Structure and Algorithm, chapter 6 · asked 2×
- B-tree of order 3 for 52, 46, 27, ... · Data Structure and Algorithm, chapter 6
- Raft 14 m × 21 m, depth of foundation · Foundation Engineering, chapter 7
- K-map Σ(1,2,3,8,9,10,11,14)+d(0,4,12), NAND · Digital Logic, chapter 3 · asked 5×
- Gumbel design flood, 21 years data, 40-year life · Engineering Hydrology, chapter 6 · asked 3×
- K-map Σ(1,2,3,8,9,10,11,13,14)+d, POS · Digital Logic, chapter 3