【发布时间】:2015-09-19 04:17:07
【问题描述】:
我现在正在研究特定哈希表中的数据结构。我遇到了以下问题:
Imagine that we have placed the following keys
in an initial empty hash table with a length of 7
with linear probing, using the following table of hash-values:
key: A B C D E F G
hash: 3 1 4 1 5 2 5
Which of the following arrays could be the linear-probing array?
1.
0 1 2 3 4 5 6
G B D F A C E
2.
0 1 2 3 4 5 6
B G D F A C E
3.
0 1 2 3 4 5 6
E G F A B C D
当我创建线性探测阵列时,我得到了这个:
0 1 2 3 4 5 6
G B D A C E F
谁能告诉我为什么我错了,正确答案是什么?
【问题讨论】:
-
该问题未指定插入键的顺序。注意如果你插入 B-D-F-A-C-E-G,你会得到表 1 作为结果。
-
在这种情况下,它应该在拼图的地方,而不是计算机课程。