我知道一些散列表使用“存储桶”,它是“条目”的链接列表。了解散列表
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