How does the hash part in hash maps work?

Posted by sub on Stack Overflow See other posts from Stack Overflow or by sub
Published on 2010-04-14T12:28:31Z Indexed on 2010/04/14 12:43 UTC
Read the original article Hit count: 292

Filed under:
|

So there is this nice picture in the hash maps article on Wikipedia:

Phonebook hashmap

Everything clear so far, except for the hash function in the middle.

  • How can a function generate the right index from any string? Are the indexes integers in reality too? If yes, how can the function output 1 for John Smith, 2 for Lisa Smith, etc.?

© Stack Overflow or respective owner

Related posts about hashmaps

Related posts about hashing