Hash Table: Why deletion is difficult in open addressing scheme

后端 未结 3 1612
时光说笑
时光说笑 2021-01-31 04:18

I am trying to understand the open addressing method. I refer to T. H. Cormen\'s book on this topic, which states that deletion is difficult in open addressing. I am completely

3条回答
  •  生来不讨喜
    2021-01-31 05:12

    In an open addressing scheme, lookups invoke a series of probes until either the key is found or and empty slot is found.

    If one key involves a chain of several probes, it will be lost (not findable) if somewhere along the chain, one of the other keys is removed, leaving an empty slot where a stepping stone was needed.

    The usual solution is to delete a key by marking its slot as available-for-resuse-but-not-actually empty. In other words, a replacement stepping stone is added so that probe chains to other keys aren't cut short.

    Hope this helps your understanding.

提交回复
热议问题