Home > Common Problem > body text

What is the hash construction method for string keywords?

藏色散人
Release: 2020-07-02 09:45:38
Original
2350 people have browsed it

The hash construction method of string keywords is "ASCII code addition method", and the algorithm statement is "h(key) = (Σkey[i]) mode TableSize".

What is the hash construction method for string keywords?

Hash construction of string keywords

ASCII code addition method

h(key) = (Σkey[i]) mode TableSize

Related introduction:

Hash table (also called hash Table) is a data structure that is directly accessed based on the key value. That is, it accesses records by mapping key values ​​to a location in the table to speed up lookups. This mapping function is called a hash function, and the array storing the records is called a hash table.

Given table M, there is a function f(key). For any given keyword value key, if the address of the record containing the keyword in the table can be obtained after substituting the function, it is called table M. is a Hash table, and function f(key) is a Hash function.

The above is the detailed content of What is the hash construction method for string keywords?. For more information, please follow other related articles on the PHP Chinese website!

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