A string hash function typically takes a string as an argument and
returns an integer which can be used as an index into a hash table
which allows it to be found quickly. The purpose is to relate a string
to something else in an efficient way. For instance, a symbol table
which stores variable names and needs to quickly find the type and the
value (or the address of the value) could use a hash table to avoid
having to search through the whole table. There are many theories on
the best hash functions for hashing strings. While two different
strings may produce the same hash index, a good hash function should
produce a reasonably uniform distribution of results, and should
produce different results for similar strings. Any hashing method
needs to deal with "collisions" or how to handle the case where two
strings are hashed to the same index. Some schemes use a linked list
or binary tree withing the hash "bucket", and some use a rehash which
stores one of the strings somewhere else. If a hash table becomes too
full, it can become much less efficient, particularly if the method of
resolving collisions is not well designed.

Don

On Jul 26, 7:49 am, syl <abeygau...@gmail.com> wrote:
> can anyone please tell me how to do hashing with strings......just
> wanna confirm...and most importantly what is the use of it...i have
> never used it....

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to