Home > Backend Development > PHP Tutorial > s[零]*31^(n-1) + s[1]*31^(n-2) + . + s[n-1] 用这种算法做hash

s[零]*31^(n-1) + s[1]*31^(n-2) + . + s[n-1] 用这种算法做hash

WBOY
Release: 2016-06-13 10:41:51
Original
1706 people have browsed it

s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1] 用这种算法做hash
s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]用这种算法做hash

怎么样?

怎么检测冲突?

当我是一段定长的字符串时候 比如说 10个字符的时候

冲突情况是怎么样的?

据说这个算法是 java的hashcode中的 不知道是不是 ? 我就发java版吧

------解决方案--------------------
海量数据的 hash 冲突是必然存在的,一般是在出现冲突时,采用顺序列表
如果你没有预留出现冲突时的存储空间,多半无解

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template