【发布时间】:2011-06-07 13:31:05
【问题描述】:
我了解某些哈希表使用“桶”,即“条目”的链表。
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?那样的话,你就在限度之内吗?哈希函数应该是这样工作的吗?
【问题讨论】:
标签: c data-structures hashtable