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

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

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

4条回答
  •  独厮守ぢ
    2021-02-01 04:51

    I think Bucket is a structure that at least contain hash value, which works as indexes, (hash values are generated by hash functions), but the structure itself might contain entries (data) or not.

    illustration:

    [hash value][points to actual data] ---> [actual data]
    |<------------bucket structure------>|

    [hash value][actual data]
    |-----bucket structure--->|

    It is the [hash value] part works as indexes.


    I found these photos from hash_table Wikipedia are pretty straightforward.

    The photos below indicates that entries (data) can be stored within buckets or it can be stored with its own data structure, while bucket simply points to the data.

    enter image description here enter image description here enter image description here

提交回复
热议问题