The fundamentals of Hash tables?

前端 未结 11 790
灰色年华
灰色年华 2020-12-07 08:23

I\'m quite confused about the basic concepts of a Hash table. If I were to code a hash how would I even begin? What is the difference between a Hash table and just a normal

11条回答
  •  离开以前
    2020-12-07 08:58

    [This is the reply to a comment made by me.yahoo.com/a above]

    That depends on your hash function. Lets suppose that your hash function hashes a word as per the length of your word, the key for chris will be 5. Similarly, key for yahoo will also be 5. Now, both values (chris and yahoo) will go under 5 (i.e. in a 'bucket' keyed by 5). This way you don't have to make an array equal to the size of your data.

提交回复
热议问题