What does “bucket entries” mean in the context of a hashtable?

前端 未结 4 1218
感情败类
感情败类 2021-02-01 04:17

What does \"bucket entries\" mean in the context of a hashtable?

4条回答
  •  温柔的废话
    2021-02-01 04:31

    Both rehashing and coalesced hashing assume fixed table sizes determined in advance. If the number of records grow beyond the number of table positions, it is impossible to insert them without allocating a larger table and recomputing hash.

    Another method of resolving hash clashes is separate chaining. Term Bucket is generally used with separate chaining. Separate chaining involves keeping a distinct linked list for all records whose keys hash into a particular value.

    Suppose that hash function produces values between 0 and tablesize - 1. Then an array bucket of header nodes of size tablesize is declared. This array is called the hash table.

    Bucket[i], bucket entry, points to the list of all records who keys hash into i. To insert a record, the list head bucket[i] is accessed and record is inserted at the tail end.

提交回复
热议问题