考虑具有100个插槽的哈希表。冲突使用链接解决。假设简单的统一哈希,在前3次插入后前3个时隙未填充的概率是多少?
(A) (97×97×97)/ 100 3
(B) (99×98×97)/ 100 3
(C) (97×96×95)/ 100 3
(D) (97×96×95)/(3!×100 3 )答案: (A)
说明:简单统一哈希函数是一种假设的哈希函数,可将项目均匀地分配到哈希表的插槽中。而且,将被散列的每个项目被放入插槽的可能性均等,而与其他已经放置的元素无关。 (来源:https://en.wikipedia.org/wiki/SUHA_%28computer_science%29)。
Probability that the first 3 slots are unfilled after the first 3 insertions =
(probability that first item doesn't go in any of the first 3 slots)*
(probability that second item doesn't go in any of the first 3 slots)*
(probability that third item doesn't go in any of the first 3 slots)
= (97/100) * (97/100) * (97/100)
这个问题的测验