Issue: I am having a hard time figuring out how to use the worst case for Rolling Hash, especially if the occurrences are only "a and b" for the string. Not only that but it is a bit of a hassle to figure out the process if the pattern that we tried to find from the given string will only contain one character occurrence, such as "bbbb".
How Rolling Hash is used in our class with a given formula and its process of solution:

Formulas:
Full document: https://drive.google.com/file/d/1vJr2UoFP7w2DFsJF9A5TmvHsoY9Zs3Iy/view?usp=sharing
The exercise problem that I am answering:
Given the following string and pattern. Determine the transition of the string comparison and hash value
when rolling hash or Rabin Karp algorithm is applied.
String = aabbaabbabbabababbbbbbaaaa
The following patterns that we need to find are:
- bbbb
- baaaa
- bbab
My attempt for pattern "bbbb" by using the "String = aabbaabbabbabababbbbbbaaaa":

Not picture form:
String = aabbaabbabbabababbbbbbaaaa
Pattern:
1. bbbb
H(bbbb) = h(2 +2 +2 +2)= 8
= h( 2103 + 2102 + 2101 + 2100)
= 2000 + 200 + 20 + 2 = 2222 mod 113
= 75
String = aabbaabbabbabababbbbbbaaaa
H(aabb ) = h(1 + 1 + 2 + 2) = 6
= h(1103 + 1102 + 2101 + 2100)
= 1000 + 100 + 20 + 2 = 1122
String = aabbaabbabbabababbbbbbaaaa
H(abba) = H(aabb)6-1+1 = 6
= 1122 – 1102 10+ 1100
= 1122 – 100 10 + 1
= 1022 *10 + 1
= 10221
I am now quite unsure with the -1 and +1 that I have annotated, in which these values involve the character present from the previous pattern but is now absent from the current pattern( - 1(where a is 1), and +1 where it is the character found from the current pattern but is absent to the previous pattern(still a).
I considered these a's because of their specific position being different, thus for me, they are considered somewhat missing/unique in comparing between two patterns.
Am I doing the process right or should I not consider these conditions? Especially since the string patterns both contain only the occurrences of a and b as we traverse in finding the exact pattern into the given string that we are using.
I decided to stop the process first since I might be doing it wrong, especially since it may take a while to find the exact pattern string.
Your response would indeed help me a lot! Thank you very much!!!

