V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
Flyshit
V2EX  ›  问与答

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

  •  1
     
  •   Flyshit · 2015-06-24 14:29:20 +08:00 · 2195 次点击
    这是一个创建于 3229 天前的主题,其中的信息可能已经有所发展或是发生改变。

    自已一直不懂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.

    3 条回复    2015-06-24 18:36:10 +08:00
    zhyu
        1
    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
        2
    Flyshit  
    OP
       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
        3
    Flyshit  
    OP
       2015-06-24 18:36:10 +08:00
    打错,应该是ASL=21/9
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2805 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 399ms · UTC 03:51 · PVG 11:51 · LAX 20:51 · JFK 23:51
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.