Hash Array Mapped Trie (HAMT)

前端 未结 4 1026
生来不讨喜
生来不讨喜 2020-12-23 14:40

I am trying to get my head around the details of a HAMT. I\'d have implemented one myself in Java just to understand. I am familiar with Tries and I think I get the main con

4条回答
  •  太阳男子
    2020-12-23 15:09

    If I were to compute a "new" hash and store the object at that new hash; how would you ever be able to look-up the object in the structure? When doing a look-up, wouldn't it generate the "initial" hash and not the "re-computed hash".

    When doing a look-up the initial hash is used. When the bits in the initial hash is exhausted, either one of the following condition is true:

    1. we end up with a key/value node - return it
    2. we end up with an index node - this is the hint that we have to go deeper by recomputing a new hash.

    The key here is hash bits exhaustion.

提交回复
热议问题