Key word storing method and storing device
A keyword and storage space technology, which is applied in the field of keyword storage methods and storage devices, can solve the problems of keyword storage location conflicts, occupying more system resources, and low probability of conflicts, etc., to achieve easy conflict adjustment, reduce conflict probability, The effect of low chance of conflict
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0023] Embodiment 1. A keyword storage method. This embodiment provides a two-level array to store keywords. The first array user stores the index information of the keyword in the second array, and the second array user stores the keyword and the corresponding Structure information; the specific process is as follows figure 1 shown, including:
[0024] A1, using the number of elements in the first array as the base of the hash function to calculate the hash value of the keyword;
[0025] In the embodiment of the present invention, the keyword is a keyword of a Java script (javascript) or a programming language such as a cascading style sheet (Cascading Style Sheet, CSS).
[0026] A2, judging whether the value of the element corresponding to the hash value in the first array is empty; if it is empty, then obtain the storage space corresponding to the first empty element in the second array, and store the Keywords are stored in the storage space;
[0027] After the keyword ...
Embodiment 2
[0041] Embodiment 2, a method for calculating a keyword hash value, the flow chart is as follows figure 2 mentioned, including:
[0042] B1, preset three hash arrays, including: the first hash array, the second hash array, and the third hash array, each hash array contains 26 elements, and each element has a preset value;
[0043] B2, using the deviation of the first character in each of the characters of the keyword and the English character sequence table as the position number to take out the corresponding first set of values in the first hash array;
[0044] B3, using the deviation of the characters on each of the keywords and the last character in the English character sequence list as the position number to take out the corresponding second group of values in the second hash array;
[0045] B4, using the deviation of the characters on each of the keywords and the second character in the English character sequence list as the position number to take out the correspond...
Embodiment 3
[0065] Embodiment 3, a keyword storage device, the structural diagram is as follows Figure 4 shown, including:
[0066] Hash value calculation unit 410, used to use the number of elements in the first array as the base of the hash function to calculate the hash value of the keyword;
[0067] The storage unit 420 is configured to determine whether the value of the element corresponding to the hash value in the first array is empty; if it is empty, obtain the storage space corresponding to the first empty element in the second array , store the keyword in the storage space, and use the index information of the first empty element in the second array in the second array as the element corresponding to the hash value in the first array The value of is recorded into the array.
[0068] It can be understood that the keyword storage device in this embodiment may further include: a conflict adjustment unit 430 configured to count the occurrence of conflicts, and adjust the hash fun...
PUM
Login to View More Abstract
Description
Claims
Application Information
Login to View More 