next up previous
Next: When to use Hashing? Up: Hashing Previous: Choosing a Hash Function

Example Hash Function

int hash(const string & s)
{
   int result = 0;
   int k;
   for (k = 0; k < s.length(); k++)
   {
      result += s[k];
   }
   return result * 7001;
}
\ul
\li result is modded by size of table
\el



Robert C. Duvall
12/4/1997