(Please do not believe all the code you found in the Web) Please
see a C langauge implementation of Karp-Rabin String matching here. This code has many problems. In particular do you see a problem with this code segment.
/* Main comparison loop */
for (i = 0; i < num_iterations; i) {
if (pattern_hash == text_hash &&
!strncmp(pattern, &(text[i]), pattern_len)) return i;
}
Your instructor created working version of this C code here.
Your job is to get a C++ version running. Test with three text strings and three
pattern strings.