确定给定 key 的双重哈希函数 ->哈希位置值
给定一堆键及其散列值,如何确定双重散列函数?
更新
我认为 h(x) = k % 13 + 1
Given a bunch of keys and their hashed values, how can I determine the double hash function?
UPDATE
I think h(x) = k % 13 + 1
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你有什么,但你想要在加一后取模,这样结果值的范围是 [0,12] 而不是 [1,13] ...但你做对了。
我对 r(x) 能想到的最好的办法是:
这对我来说真的毫无意义,为什么会这样,但我得出这个结论的方法是,模除数必须将移位增加 6,因为给出的值(38 和 101 的模 13 相差 1,并且它们相距 6 个空格)。我觉得模 19 确实实现了这一突破,所以虽然这似乎很合适,但我会寻求更好的答案,但这就是我想到的,我觉得我有一种超越猜测和检查的方法。
祝你好运,如果您对此有任何疑问,请随时发表评论。
what you had, but you want the modulo after adding one so the resultant values are range [0,12] not [1,13] ... but you had it right.
the best I could come up with for r(x) was:
this really makes no sense to me why it would be this, but the way that I came to this was that the modulo divisor must have increased the shift by 6 because of the values given (38 and 101 have a difference of 1 for modulo 13 and they were six spaces apart). I feel like the modulo 19 really makes this break, so while this seems to fit, I would seek a better answer, but that's what I came up with and I feel like I kind of had a method over guess and check.
Best of luck, feel free to drop comments if you have any questions about this.