散列表习题

1、

考虑key的集合S = {0, 8, 16, 24, 32, 40, 48, 56, 64}

用除余法构造的散列函数

h1(key) = key % 12

h2(key) = key % 11

h1将S映射到的值域有几个元素?

____3

h2将S映射到的值域有几个元素?

____9

2、散列表的规模是素数,用开放定址+平方试探法排解冲突,若要保证新的词条能够顺利插入,散列表的装填因子不能超过(请填十进制小数)

0.5

3、对[0, 11)中的整数{ 10, 4, 2, 9, 3, 1, 2, 2, 4, 9, 8, 5, 9, 10, 7, 6, 9 }用计数排序,得到的accum[]表为:

{0, 1, 4, 5, 7, 8, 9, 10, 11, 15, 17}

4、

The current state of the bucket array of size 11 is A = {*, *, *, *, *, 0, 15, 26, *, 5, 9}, where * means empty bucket
规模为11的桶数组当前状态为 A = { *, *, *, *, *, 0, 15, 26, *, 5, 9},其中*表示空桶

The hash function is h(key) = (3 * key + 5) % 11
散列函数为h(key) = (3 * key + 5) % 11

Using Open addressing + Linear probing to solve conflicts
用开放定址+线性试探排解冲突

Insert the entry 4, its actual storage location is
插入词条4, 它的实际存放位置是

A[6]

5、

规模为11的桶数组当前状态为 A = { *, *, *, *, *, 0, 15, 26, *, 5, 9},其中*表示空桶

The hash function is h(key) = (3 * key + 5) % 11
散列函数为h(key) = (3 * key + 5) % 11

Using Open addressing + quadratic probing to solve conflicts
用开放定址+平方试探排解冲突

Insert the entry 4, its actual storage location is
插入词条4, 它的实际存放位置是

A【4】

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值