mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 17:34:49 +08:00
[pre-commit.ci] pre-commit autoupdate (#11322)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.2.2 → v0.3.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.2.2...v0.3.2) - [github.com/pre-commit/mirrors-mypy: v1.8.0 → v1.9.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.8.0...v1.9.0) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
![66853113+pre-commit-ci[bot]@users.noreply.github.com](/assets/img/avatar_default.png)
committed by
GitHub

parent
5f95d6f805
commit
bc8df6de31
@ -1,21 +1,21 @@
|
||||
"""
|
||||
This algorithm was created for sdbm (a public-domain reimplementation of ndbm)
|
||||
database library.
|
||||
It was found to do well in scrambling bits, causing better distribution of the keys
|
||||
and fewer splits.
|
||||
It also happens to be a good general hashing function with good distribution.
|
||||
The actual function (pseudo code) is:
|
||||
for i in i..len(str):
|
||||
hash(i) = hash(i - 1) * 65599 + str[i];
|
||||
This algorithm was created for sdbm (a public-domain reimplementation of ndbm)
|
||||
database library.
|
||||
It was found to do well in scrambling bits, causing better distribution of the keys
|
||||
and fewer splits.
|
||||
It also happens to be a good general hashing function with good distribution.
|
||||
The actual function (pseudo code) is:
|
||||
for i in i..len(str):
|
||||
hash(i) = hash(i - 1) * 65599 + str[i];
|
||||
|
||||
What is included below is the faster version used in gawk. [there is even a faster,
|
||||
duff-device version]
|
||||
The magic constant 65599 was picked out of thin air while experimenting with
|
||||
different constants.
|
||||
It turns out to be a prime.
|
||||
This is one of the algorithms used in berkeley db (see sleepycat) and elsewhere.
|
||||
What is included below is the faster version used in gawk. [there is even a faster,
|
||||
duff-device version]
|
||||
The magic constant 65599 was picked out of thin air while experimenting with
|
||||
different constants.
|
||||
It turns out to be a prime.
|
||||
This is one of the algorithms used in berkeley db (see sleepycat) and elsewhere.
|
||||
|
||||
source: http://www.cse.yorku.ca/~oz/hash.html
|
||||
source: http://www.cse.yorku.ca/~oz/hash.html
|
||||
"""
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user