How are hash collisions handled?

前端 未结 3 859
野的像风
野的像风 2021-01-18 08:03

I\'ve recently learned a little bit about hash values, and therefore also heard of about the problem of hash collisions.
I therefore wondered: How does one deal with tho

3条回答
  •  逝去的感伤
    2021-01-18 08:36

    There are two basic techniques:

    1. Rehash using a different prime, typically N- 2 where N is the original prime, chosen such that both N and N-2 are prime.
    2. Use a list per hash.

    Or both.

提交回复
热议问题