h(K) = [K + (i-1)] mod 5
h(K) = [K + (i-1)²] mod 5
to insert the same records?
h(k) = (h1(k) + (i-1)h2(k)) mod N
.
Is it possible to overcome secondary clustering with only a single
hashing function? If so, describe the method, and if not, explain why.
M
initial buckets, and an initial hashing function of
h(K) = K mod M
which of the following occurs when a bucket B
overflows
for the second time?
2B
is allocated.
B + 2M
is allocated.
B + 4M
is allocated.
h(K) = K mod 2M
.
h(K) = K mod 4M
.
h(K) = K mod 8M
.
maxKey
table are shown in the figure below. The hash
function is h(K,i) = (K + i-1) mod 4
. Show the state of
the file and of the maxKey
table following the insertion of a
record with key 28 into the file.
Bucket | maxKey | contents |
---|---|---|
0 | 16 | 4 16 8 |
1 | 43 | 9 43 25 |
2 | 26 | 18 26 |
3 | 19 | 7 3 19 |
R
to fail even
though there is enough room in the file to accommodate a record?
Explain.
R
, into a full bucket may require that another
record, R'
be removed from that bucket and re-inserted
elsewhere. Is it possible that this re-insertion of record
R'
would require record R
to be re-inserted,
and so on, thus resulting in an infinite loop? Explain.
B(K,i)
,
is required to guide the traveral of a binary tree towards
the bucket containing the record with key K
. The function
outputs either 0 or 1, based on the values of the key, K
,
and the tree level, i
.
B(K,i)
?
int B(int K, int i) { int pos, bit; pos = 1 << i; /* calculates 2^i */ bit = (K & pos) >> i; /* obtains the ith bit of K */ return (bit); }
B(K,i)
.
h(K) = K mod 4
and the first few bits of the B
string associated with each key in
the file are given in the table below. Each bucket can hold up to 2
records. Show the state of the directory and the file after the records
with keys 17, 13, 16, 5, and 25 are inserted.
Key | B |
---|---|
17 | 01101 |
13 | 00101 |
16 | 10110 |
5 | 11110 |
25 | 01001 |