Hashtable/Dictionary collisions

后端 未结 5 1141
孤街浪徒
孤街浪徒 2021-01-06 11:39

Using the standard English letters and underscore only, how many characters can be used at a maximum without causing a potential collision in a hashtable/dictionary.

5条回答
  •  再見小時候
    2021-01-06 11:59

    A hash algorithm isn't supposed to guarantee uniqueness. Given that there are far more potential strings (26^n for n length, even ignoring special chars, spaces, capitalization, non-english chars, etc.) than there are places in your hashtable, there's no way such a guarantee could be fulfilled. It's only supposed to guarantee a good distribution.

提交回复
热议问题