- 49
- 0
- 约7.59千字
- 约 7页
- 2021-03-16 发布于天津
- 举报
word
word文档可自由复制编辑
《数据库理论与技术》复习题
1.考虑用二元联系(图1)对三元联系(图2)的表示:
图1图2
图1
图2
1) 分别给出图1中E, A,B, C, RA,RB和RC的一个实例,这些实例不 对应图2中A,B,C和R的任何实例;
2) 更改图1中的ER图,引入适当的约束以确保满足约束的 E,A,B,C,
RA,RB和RC的任何实例都对应于 A,B,C和R的一个实例;
3) 更改以上的转化以表示在三元联系上的全参与约束;
4) 以上表示要求为E创建一个主码属性,试问如何将 E处理为弱实体集,
以便不需要主码?
解:
1) 令 E = {e1, e2}, A = {a「a2}, B = {S}, C = {C1}, Ra = {(e1, aj, (e2, a2)},Rb={(e1,b1)}, Rc={(e1,c1)};
可以看出,由于元组(e2,a2 )的原因,不存在任何实例对应于 E,Ra,Rb,Rc
2) 如下图所示:通过引入 E和关系Ra, Rb, Rc之间的全部参与的约束条件,以便在 E中的每个元
组都和A,B,C有关系。
3) 假设A
3) 假设A全部参与关系 R,则在A和Ra之间引入全部参与约束。
4) 将 E看作弱实体集,而将 Ra,Rb,Rc看作标志联系集
如下图所示
2. Suppose that we are using extendable hashing on a file that contains records with the followi ng search-key values:
2, 3, 5, 7, 11, 17, 19, 23, 29, 31,35,27
Show the exte ndable hash structure for this file if the hash fun cti on is h(x) = x mod 8 and buckets can hold three records.
2.解:
(1)
(一点疑惑:这道题用的不是书中的用高位 extendable hash?只有凭感觉做
了,不一定正确,拉链法扩展,超出 24后乘2 rehash)
(若是按书上的,先 mod 8得到hash值,取高位二进制 …最多111,即 directory depth 最大为 3)
Bucket 号
0:
1: [17,]
2: [2]
3: [3,11,19] - [35,27]
4:
5: [5,29]
6:
7: [7,23,31]
(2)只注明了修改的行
Bucket3 : [3,19,35] - [27]
Bucket7 : [7,23,31] - [15]
Bucket7 : [7,23, 15]
Bucket1 : [17,25]
答案类似下面:
hurkpt
0
T
2
3
4
5
6
7
record
376(1
11174
5651
1620
iQ
5046
4H7I
7(15
242H
5I57
2222
轴81
4750
6975
Show how the extendable hash structure of part 1) changes as theresult of each of the following steps:
Delete 11.
I nsert 15.
Delete 31.
I nsert 25.
3.Insert 2369, 37DSuppose thatInsert 3943Bloom filter usesm=32 bits, and3 hash functions h1, h2,
3.
Insert 2369, 37D
Suppose that
Insert 3943
Bloom filter uses
m=32 bits, and
3 hash functions h1, h2,
2 3
and h3, where hi(x) = ((x +x )*i) mod m .
3.答:(1)(2)直接套hash函数
(3)套公式:
任何一位k个hash后还是为0的概率:p=(1-1.0/m)
误判率:f = (1-p)k
Show the Bloom filter bits following each of the following six elements insertions in order: 2013, 2010, 2007, 2004, 2001, 1998
For the Bloom filter obtained after part 1), find one value that is not among the six in serted values, but is a
原创力文档

文档评论(0)