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】