- Asked 2/14
- 2070 Bhadra · 2+3 marks
B-tree properties; order 5 for 3, 14, 7, ...
Short answer
B-tree properties: max m children, min ⌈m/2⌉ children for non-root, all leaves same level, keys sorted, tree balanced. Constructed order-5 B-tree: root [7 13] with leaves [1 3 5] [8 11] [14 17].
Write down the properties of B-tree. Construct a B-tree of order 5 for following data: 3, 14, 7, 1, 8, 5, 11, 17, and 13.
Properties of a B-tree of order m
- Every node has at most m children, i.e. at most m − 1 keys.
- Every non-root, non-leaf node has at least ⌈m/2⌉ children (and every non-root node has at least ⌈m/2⌉ − 1 keys).
- The root has at least 2 children if it is not a leaf.
- A node with k children holds k − 1 keys, stored in ascending order.
- All leaves are on the same level, so the tree is perfectly height-balanced.
- For a node with keys k₁ < k₂ < ..., the subtree to the left of k₁ holds keys smaller than k₁, the subtree between kᵢ and kᵢ₊₁ holds keys that lie between them, and the subtree to the right of the last key holds larger keys.
- The tree grows and shrinks at the root; search, insert and delete take O(log n).
B-tree of order 5 (max 4 keys, min 2 keys per non-root node)
| Step | Insert | Tree after step | Action |
|---|---|---|---|
| 1 | 3 | [3] | fits in leaf |
| 2 | 14 | [3 14] | fits in leaf |
| 3 | 7 | [3 7 14] | fits in leaf |
| 4 | 1 | [1 3 7 14] | fits in leaf |
| 5 | 8 | [7]{[1 3], [8 14]} | leaf [1 3 7 8 14] overflows, split: 7 moves up; new root |
| 6 | 5 | [7]{[1 3 5], [8 14]} | fits in leaf |
| 7 | 11 | [7]{[1 3 5], [8 11 14]} | fits in leaf |
| 8 | 17 | [7]{[1 3 5], [8 11 14 17]} | fits in leaf |
| 9 | 13 | [7 13]{[1 3 5], [8 11], [14 17]} | leaf [8 11 13 14 17] overflows, split: 13 moves up |
Final tree
[7 13]
[1 3 5] [8 11] [14 17]
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- B-tree of order 5 for 82, 12, 22, ... · 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×
- 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
- Spanning tree properties; Round Robin MST · Data Structure and Algorithm, chapter 10
- AVL tree for 3, 2, 1, 4, 5, 6, 7, ... · Data Structure and Algorithm, chapter 6
- K-map Σ(1,2,3,8,9,10,11,13,14)+d, POS · Digital Logic, chapter 3
- K-map Σm(7,9,12,13,14,15)+d, NOR-only · Digital Logic, chapter 3
- Minterms/maxterms; K-map Σm(2,4,5,13,14)+d, universal gates · Digital Logic, chapter 3
- Minterms/maxterms; K-map Σm(0,1,2,4,6,8,9,12,13,14) · Digital Logic, chapter 3