Hash Function, Hash Table

How can I write a good hash function that takes input as a string and returns a integer with minimum number of collisions between strings.

I have a bunch of strings(phrases).
How can I create a hash table using the above hash function(that maps each word to a slot in the table) such that each slot in the hash table contains the word and pointers to the strings the contain that specific word.
If their is a collision the hash function should put the word and the corresponding pointers in the next available slot.

I am basically trying to implement inverted-indexing using hash tables.
std::unordered_map ?

There are plenty of info on hashing strings if you google.

http://en.wikipedia.org/wiki/List_of_hash_functions
might be a decent place to start.
Topic archived. No new replies allowed.