Discuss the below:
Q: Consider the given hashing function object for strings. What can you say about strings "aefghk" and "gaefkh"? Is this a good hashing function? Why?
class hFstr
{
public:
unsigned int operator () (const string& s) const
{
int i;
unsigned int hashval = 0;
for ( i = 0; i < s.length(); i++)
hashval += s[i];
return hashval;
}
};