------ Solution -------------------------- ------------------
standard chain address method hash table handling conflict
There open the address , LZ can go refer
------ Solution --------------- -----------------------------
arrays do not have much to say. As to why a linked list , I want to ask : Big Brother , why replace ah ? ! Suppose you had wanted
{
"KEY": "VALUE", / / Hash corresponding storage location
"A": "123", / / 0
"B": "456", / / 1
"C": "555", / / 4
"D": "666", / / 3
"E": "777", / / 2
"X": "XYZ" / / 0
}
Well, apparently , you do not want to let Key = "X" in Entry obliterated Key = "A" , but I hope they coexist peacefully bar. Therefore, the hash calculated after the storage location of the way through the list to avoid errors .
------ For reference only ---------------------------------- -----
key is the same as original replacement . Wait, " on the computer to find the same hash value different input is impossible ," Who taught you , do not tell him after playing
------ For reference only ---- -----------------------------------
Baidu Encyclopedia said, ah ? Do I have to abandon Baidu up ? http://baike.baidu.com/view/273836.htm?fromId=1041476
------ For reference only ------------------- --------------------
Baidu Encyclopedia said, ah ? Do I have to abandon Baidu up ? http://baike.baidu.com/view/273836.htm?fromId=1041476
public class Bean {
public int hashCode() {
return 47;
}
}
------ For reference only ----------------------------------- ----
Baidu Encyclopedia said, ah ? Do I have to abandon Baidu up ? http://baike.baidu.com/view/273836.htm?fromId=1041476
haste to abandon
------ For reference only ------------------------------- --------
------ For reference only ---------------------------------- -----
Baidu Encyclopedia said, ah ? Do I have to abandon Baidu up ? http://baike.baidu.com/view/273836.htm?fromId=1041476
although according to different hash algorithm is likely not cause conflict , but conversely , such a data structure can also cause a huge waste of memory . Therefore, a limited
Hash table memory structure is necessary , in this state , will greatly enhance the possibility of conflict .
In addition , they said the same upstairs , absolutely no conflict Hash algorithm , this looks like yet mathematically rigorous proof , huh, huh .
------ For reference only -------------------------------------- -
you mean through the hash algorithm to calculate the hash value may be the same , so the storage location in the array to create a linked list to store the data in the same hash value , is this you ?
------ For reference only ---------------------------------- -----
nobody Replies ready Results posted oh ......
------ For reference only ------------------- --------------------
you mean through the hash algorithm to calculate the hash value may be the same , so the storage location in the array to create a linked list to store the data in the same hash value , is this you ?
right, but not necessarily the same hash value . Focus is calculated through the hash stored. Suppose you array only 50 locations. Possible hash = 1 and hash = 1234567 calculated position is the same. Of course, the two hash the same key, the position is the same.
------ For reference only -------------------------------------- -
when key equal or equals the time originally covered ah , the key is calculated based on the hashcode calculation key array subscript position , multiple key 's hashcode the same time will be a linked list stored . Put the array is a linked list head node . Suggest look at the source code for it Find
array traversal fast, chain delete, insert, fast , combined with a little bit of both
没有评论:
发表评论