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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 13:19:26
Original
930 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
Latest Issues
Install JAVA
From 1970-01-01 08:00:00
0
0
0
Unable to install java
From 1970-01-01 08:00:00
0
0
0
Can java be used as the backend of the web?
From 1970-01-01 08:00:00
0
0
0
Is this in Java language?
From 1970-01-01 08:00:00
0
0
0
Help: JAVA encrypted data PHP decryption
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template