问个比较基础的问题,是关于数据结构中的 HASH

2015-06-24 14:29:20 +08:00
 Flyshit

自已一直不懂HASH这方面的知识,最近回头重新学习数据结构,在一本国外教科书上看到了一个问题,没找到答案,各位V友能帮忙算下答案吗?thx!
Q:
Assume that you have a eleven-slot closed hash table (the slots are numbered 0 through 10). Show the final hash table that would result if you used the hash function h(k) = k mod 11 and quadratic probing on this list of numbers: 3, 12, 31,9, 53,2, 79, 25, 46.

2207 次点击
所在节点    问与答
3 条回复
zhyu
2015-06-24 14:34:59 +08:00
题目说了 "used the hash function h(k) = k mod 11 and quadratic probing"

所以 https://en.wikipedia.org/wiki/Quadratic_probing
Flyshit
2015-06-24 18:35:10 +08:00
耐心看下书,搞定了
HASH表:46 12 2 3 25 -- 79 -- 53 31 9
探查次数: 6 1 1 1 2 -- 4 -- 3 1 2
AVL=21/9
不知道有没有错,但愿别误导到未来搜索到此贴的朋友 0.0
话说V2EX没有编辑功能么?
Flyshit
2015-06-24 18:36:10 +08:00
打错,应该是ASL=21/9

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/200797

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX