# hw2KEY - COP 3530 Homework Problems#2 Summer 2002 SOLUTION...

This preview shows pages 1–3. Sign up to view the full content.

COP 3530 – Homework Problems #2 – Summer 2002 1. Shown below is a B-Tree of order 6 at some point in time. Show the tree at each time instance after each “access” to the tree in the following “access sequence” occurs. Access sequence: (insert 4), (insert 30), (insert 24), (delete 18), (delete 24) (a) Initial B-tree (b) B-tree after inserting 4 into full leaf node. Node splits and highest key in old leaf (after splitting equally) moves to parent (key value 2 in this case). (c) B-tree after inserting 30 into leaf with room. No splitting occurs, but node is now full. (Nodes are vertical to fit all four nodes on the same level on the paper.) Homework #2 KEY - 1 16 0 1 2 5 7 18 25 27 28 SOLUTION KEY 2 16 0 1 18 25 27 28 4 5 7 2 16 0 1 18 25 27 28 30 4 5 7 2 16 25 0 1 18 24 4 5 7 27 28 30

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
(d) B-tree after inserting 24 into full leaf node. Node splits and highest key in old node (after splitting) moves to parent (key value 25 in this case). (e) B-tree after deletion of key value 18. Deletion causes an underflow. Since the sibling contains more than m/2 -1 = 2, key values, then all keys from the underflowing leaf and the sibling are redistributed between them by moving the separator key (25 in this case) from the parent into the underflowing leaf and moving one key from the sibling to the parent to become the new separator key (27 in this case). (f) B-tree after deletion of key value 24. Deletion causes underflow since number of key values in this node becomes less than m/2 -1 = 2 , however, we cannot “steal” a key value from the sibling in this case since that would cause the sibling to underflow. So the underflowing node, the separator key, and the sibling are merged.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 15

hw2KEY - COP 3530 Homework Problems#2 Summer 2002 SOLUTION...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online