Hi ,
i want to use hash tables in my project.
i got few codes in that i got some function called hash()
int hash(char *s)
{
int h =0;
for (; *s;s++)
h = *s + h * 31;
return h % 101;
}
i understand the process of hash tables but i dont understand
how below statements
h = *s + h * 31;
return h % 101;
give a value that will not exceed the array size as choosen(101).
is there any relation between those two statements.
i dont seem the need of using all code here.
though if you want i can provide.
Thanks,
Danian