The hash construction method of string keywords is "ASCII code addition method", and the algorithm statement is "h(key) = (Σkey[i]) mode TableSize".
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!