Professional Documents
Culture Documents
• 22/03/2018
• Total of 13 marks.
Student/Staff Nr:
Instructions
Page 1 of 3
COS 212 Tutorial 5: 22/03/2018
Solution:
1.2 Consider the B-tree in figure 1. Delete the key 56 from this tree and draw as your answer only the final tree (3)
after this deletion.
Solution:
50
61 69 74 85
10 20
30 31 32 55 60
11 12 62 63
1 2 70 71 72 73
79 80 82 83
89 90 92
Page 2 of 3
COS 212 Tutorial 5: 22/03/2018
50
60 69 74 85
10 20
30 31 32 55 56
11 12 61 62 63
1 2 70 71 72 73
79 80 82 83
89 90 92
Figure 1: B-Tree
1.3 Consider the B-tree in figure 1. Delete the key 2 from this tree and draw as your answer only the final tree (4)
after this deletion.
Solution:
60
69 74 85
20 50
55 56
30 31 32 61 62 63
1 10 11 12 70 71 72 73
79 80 82 83
89 90 92
Solution: B-Trees can be 1/2 empty, B* -trees utilize space better in that the nodes are required to be
at least 2/3 full (thus space is utilized more optimally).
2.2 In a B* -tree the following restriction is given: Only the root node is allowed to underflow and all other nodes (3)
must be at least b 2m−1
3 c full at any time. Under this restriction, special care needs to be taken when dealing
with root splits. Firstly, name a problem that could potentially arise in the case of a root split and secondly,
discuss a strategy to prevent this problem from occuring.
Solution: If the root is the same size as the other nodes, then there will only be enough keys to ensure
that the children of the new root are 50% full after the root splits, leading to them underflowing. (1
Mark)
Suggestion: Maintain a root that is larger than the other nodes in the tree. Make sure that if the root
splits, there will be enough keys so that each of the new root’s children can get b 2m−1
3 c keys, and there
Page 3 of 3
is a separator key for the new root. (2 marks)