This preview shows pages 1–3. Sign up to view the full content.
CSE671  Introduction to DB Systems II
Solution to Homework 2
Problem 1: Extensible Hash Table (30 points)
Consider indexing the following key values using an extensible hash table. Suppose that
we insert the keys in the order of
44, 36, 30, 56, 34, 62, 50, 22
The hash function h(n) for key n is h(n) = n mod 16; i.e., the hash function is the
remainder after the key value is divided by 16. Thus, the hash value is a 4bit value.
Assume that each bucket can hold 2 data items.
(1) Draw the hash index (both the directory and the buckets), after the first four keys are
inserted. Show the keys themselves in the buckets, as well as the hash values. Be sure to
indicate the number of bits in the hash value that are used (in the directory as well as each
bucket). (10 POINTS)
(2) Draw the hash index after all the keys are inserted. (
±² 10*/54
)
00
01
11
10
36 (0100)
56 (1000)
44 (1100)
30 (1110)
d=2
1
2
2
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document Problem 2: Linear Hashing vs. B+tree (40 points)
Consider indexing the following key values using a linear hash table and a B+ tree. Here is
the specification of these index structures.
The hash function h(n) for key n is h(n) = n mod 16; i.e., the hash function is the
remainder after the key value is divided by 16. Thus, the hash value is 4 bits. Assume that
each bucket can hold 2 data items. We adopt the policy that the average occupancy of a
bucket cannot exceed 85% of the capacity of a block.
The B+ tree is of order 2 (i.e., n=2).
This is the end of the preview. Sign up
to
access the rest of the document.
This note was uploaded on 04/13/2010 for the course CSE 671 taught by Professor Hakanferhatosmanoglu during the Winter '06 term at Ohio State.
 Winter '06
 HakanFerhatosmanoglu

Click to edit the document details