We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f17e982 commit 9b376a5Copy full SHA for 9b376a5
strings/rabin_karp.py
@@ -40,7 +40,7 @@ def rabin_karp(pattern, text):
40
return True
41
if i == t_len - p_len:
42
continue
43
- # Calculating the ruling hash
+ # Calculate the https://en.wikipedia.org/wiki/Rolling_hash
44
text_hash = (
45
(text_hash - ord(text[i]) * modulus_power) * alphabet_size
46
+ ord(text[i + p_len])
0 commit comments