Went over this in class today:
const int tabsize = 100000; int hash(string s) { const int init = 21512712, mult = 96169, emergency = 876127; int v = init; for (int i=0; i<s.length(); i+=1) v = v * mult + s[i]; if (v < 0) v = -v; if (v < 0) v = emergency; return v % tabsize; } Having some trouble figuring out what the last 2 if-statements are supposed to do.
Any ideas?
Thanks