In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
What is the principle of hash algorithm, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.
Direct addressing method:
For example, if you have 100 employees and 100 job numbers, you will use them as hash.
Digital analysis method:
Without losing generality, we only give 8 keywords for analysis, and the 8 keywords are as follows:
This method is suitable for pre-estimating the frequency of the occurrence of various numbers in each bit of all keywords.
K1x 61317602 K2K 61326875 K3O 62739628 K4K 61343634
K5Qing 62706815 K636 62774638 K7 61381262 K8 61394220
The method of taking some digits with uniform values in the keywords of data elements as hash addresses
Example 2 is to construct a hash table with the number of data elements natively 80 and the hash length massively 100.
Folding method:
A situation in which there are a large number of keywords and the number on each bit in the keyword is roughly evenly distributed.
The keyword is divided into parts with the same number of digits (the number of bits in the last part can be different), and then the superposition of these parts is taken (rounding out carry). This method is called folding.
This method is suitable for:
Square centering method:
The hash function values obtained by different keywords are not easy to conflict.
The resulting hash address is also more uniform.
First take the square of the keyword, and then according to the size of the available space, select the middle bits of the square as the hash address
The principle is to enlarge the difference by taking the square, and the middle digits of the square are related to each digit of this number.
This method is suitable for the phenomenon that every keyword has a high repetition frequency of some numbers.
Subtraction method
The subtraction method is the key value of the data minus a specific value to find the location of the data storage.
Cardinal conversion method
Think of the decimal number X as another base
For example, the decimal number is converted into a decimal number according to the decimal number, and some of them are extracted as the hash value of X.
Generally, the number larger than the original cardinality is taken as the cardinality of the transformation, and the two cardinal numbers should be mutually prime.
The method of division and remainder:
The theoretical study shows that the effect is the best when the modulus p of the residue method is not larger than the table length and is closest to the table length m prime number.
Random number method:
This method is suitable for constructing hash functions for keywords with different lengths.
Random multiplier method string numerical hash method rotation method
For the data with high similarity, the reverse is very uniform.
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.