我知道一些散列表使用「存儲桶」,它是「條目」的鏈接列表。瞭解散列表
HashTable
-size //total possible buckets to use
-count // total buckets in use
-buckets //linked list of entries
Entry
-key //key identifier
-value // the object you are storing for reference
-next //the next entry
爲了通過指數來獲得鬥,你必須調用:
myBucket = someHashTable[hashIntValue]
然後,直到你找到你正在尋找或空的一個,你可以重複條目的鏈接列表。
散列函數是否總是返回NUMBER % HashTable.size
?這樣,你保持在極限內?那哈希函數應該如何工作?
投下了這個答案的人可以提供解釋嗎?我會猜測他們不會。 – 2011-01-12 01:56:16