454.3-09.Solution2

454.3-09.Solution2 - CMPT-454 Fall 2009 Instructor: Martin...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
G T C N Q X B* C* E* G* N* P* Q* T* X* Z* CMPT-454 Fall 2009 Instructor: Martin Ester TA: Yi Liu Solution Assignment 2 Total marks: 200 (20 % of the assignments) Due date: October 14, 2009 Problem 2.1 (50 marks) Consider B-trees of order n = 2, i.e. each node of the B-tree contains one or two search key values. We denote index entries by A, B, etc. and data entries by A*, B*, etc. a) Insert the following search keys in the given order into an initially empty tree: Z, C, B, Q, P, G, T, X, E, N Draw the resulting B-tree. b) Consider the following B-tree:
Background image of page 1

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

View Full DocumentRight Arrow Icon
27 55 18 23 40 60 10* 18* 23* 25* 27* 30* 40* 55* 60* 80* 27 55 23 30 60 18* 23* 25* 27* 30* 55* 60* 80* Delete the entry (40 *) from this tree. Then delete the entry 10* from the resulting tree (without 40) and draw the final tree. Try re-distributions first before coalescing underflowing nodes. c) Assume that we use alternative 1 for the data entries, i.e. the leaf nodes of the B-tree contain the complete data records. Assume further that no buffer blocks are allocated to the B-tree, i.e. each node access requires a block I/O. What is the cost (number of block I/Os) of - any equality search - the range search “ 55 25 searchkey on the tree used as input for b), i.e. before the deletions.
Background image of page 2
We are assuming that the B-tree does not contain duplicate search key values. Any equality search traverses one path from the root of the B-tree to the leaf corresponding to the search key value, i.e. the cost is 3 I/Os. The range search first performs an equality search for the lower boundary (25) of the range which costs 3 I/Os. Then, it follows the leaf links until it finds an entry with a search key value greater or equal than the upper boundary (55) of the range, i.e. until it finds the entry 55*. The sequential search over the leaf nodes costs 3 I/Os. Thus, the total cost for this range search is 3+3=6 I/Os. Note : If duplicates were allowed, then the sequential search of leaf nodes needs to proceed until a search key value strictly greater than the upper boundary of the range (60) is found. Then, the total cost for this range search is 3+4=7 I/Os. How would your answers to the above two questions change when we instead use
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 8

454.3-09.Solution2 - CMPT-454 Fall 2009 Instructor: Martin...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online