Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

9
  • 39
    One entry per key, yes, but not one entry per hash. Commented Feb 26, 2018 at 12:34
  • 6
    The wikipedia article on hash tables, especially the part on separate chaining collision resolution has a good illustration about how the values are stored internally in a linked list. You need to iterate through the list to reach the correct value because the list (the bucket) is only accessible through the hash code. Commented Feb 26, 2018 at 12:59
  • 4
    Your analysis is incomplete: you overlooked that the put method also has a for loop. That should go some way towards answering your question. Commented Feb 26, 2018 at 13:58
  • 2
    @DanielPryden agreed. The best way is to try and implement one yourself - or a simpler implementation of the same as a learning tool. Sooner or later, you'll run into the exact same problem that the for loop fixes, and you'll know why. Commented Feb 26, 2018 at 16:58
  • 1
    Possible duplicate of How does a hash table work? Commented Feb 27, 2018 at 11:22