- Asked 2/14
- 2075 Baisakh · 5 marks
B-tree of order 5 for 82, 12, 22, ...
Short answer
Keys inserted sequentially; a node overflows at 5 keys and splits, moving median up. Final tree: root [23 56 82] and leaves [12 22], [28 37 44], [59 60 65 74], [96 99].
Construct a B-tree of order 5 for the following data: 82, 12, 22, 23, 56, 96, 37, 99, 59, 74, 28, 65, 60 and 44.
A B-tree of order 5 allows at most 5 children (4 keys) per node and at least 2 keys in a non-root node. A key is inserted into its leaf; if the leaf then holds 5 keys it overflows, is split at the median, and the median moves up to the parent. The split may repeat up to the root.
Step-by-step construction
| Step | Insert | Tree after step | Action |
|---|---|---|---|
| 1 | 82 | [82] | fits in leaf |
| 2 | 12 | [12 82] | fits in leaf |
| 3 | 22 | [12 22 82] | fits in leaf |
| 4 | 23 | [12 22 23 82] | fits in leaf |
| 5 | 56 | [23]{[12 22], [56 82]} | leaf [12 22 23 56 82] overflows, split: 23 moves up; new root |
| 6 | 96 | [23]{[12 22], [56 82 96]} | fits in leaf |
| 7 | 37 | [23]{[12 22], [37 56 82 96]} | fits in leaf |
| 8 | 99 | [23 82]{[12 22], [37 56], [96 99]} | leaf [37 56 82 96 99] overflows, split: 82 moves up |
| 9 | 59 | [23 82]{[12 22], [37 56 59], [96 99]} | fits in leaf |
| 10 | 74 | [23 82]{[12 22], [37 56 59 74], [96 99]} | fits in leaf |
| 11 | 28 | [23 56 82]{[12 22], [28 37], [59 74], [96 99]} | leaf [28 37 56 59 74] overflows, split: 56 moves up |
| 12 | 65 | [23 56 82]{[12 22], [28 37], [59 65 74], [96 99]} | fits in leaf |
| 13 | 60 | [23 56 82]{[12 22], [28 37], [59 60 65 74], [96 99]} | fits in leaf |
| 14 | 44 | [23 56 82]{[12 22], [28 37 44], [59 60 65 74], [96 99]} | fits in leaf |
Final B-tree of order 5
[23 56 82]
[12 22] [28 37 44] [59 60 65 74] [96 99]
All leaves are on the same level and every node respects the key limits.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- B-tree properties; order 5 for 3, 14, 7, ... · Data Structure and Algorithm, chapter 6 · asked 2×
- B-tree from 78, 21, 14, 11, 97, 85, 74, 63 · Data Structure and Algorithm, chapter 6 · asked 2×
- Merge sort on 47, 27, 56, 23, ... · Data Structure and Algorithm, chapter 7
- AVL tree for 52, 65, 72, 15, 11, 32, 20 · Data Structure and Algorithm, chapter 6
- B-tree of order 5 for letters C N G A H ... · Data Structure and Algorithm, chapter 6 · asked 2×
- B-tree of order 3 for 52, 46, 27, ... · Data Structure and Algorithm, chapter 6
- Heap sort on 37, 33, 26, 92, ... · Data Structure and Algorithm, chapter 7
- Partial r12.3 and multiple R1.23 (0.59, 0.46, 0.77) · Probability and Statistics, chapter 5 · asked 3×
- Chi-square test on 100 random numbers · Simulation and Modeling, chapter 6
- Grit chamber for 60 MLD, 0.23 mm · Sanitary Engineering, chapter 7 · asked 2×
- File size: 60 s, 44.1 KHz, 8-bit stereo · Multimedia System, chapter 2 · asked 3×