From c0954e5ea73afa71248d4bc08ed5e04106e05758 Mon Sep 17 00:00:00 2001 From: Nolan Emirot Date: Sat, 28 Mar 2020 20:30:59 -0700 Subject: [PATCH 1/2] Update rabin_karp.py fix: typo --- strings/rabin_karp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/strings/rabin_karp.py b/strings/rabin_karp.py index 1fb145ec97fa..c1191d47fea3 100644 --- a/strings/rabin_karp.py +++ b/strings/rabin_karp.py @@ -40,7 +40,7 @@ def rabin_karp(pattern, text): return True if i == t_len - p_len: continue - # Calculating the ruling hash + # Calculating the rolling hash text_hash = ( (text_hash - ord(text[i]) * modulus_power) * alphabet_size + ord(text[i + p_len]) From 2adade58d9839cebaae073a857ea880fd9929dc5 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 29 Mar 2020 10:19:05 +0200 Subject: [PATCH 2/2] Update rabin_karp.py --- strings/rabin_karp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/strings/rabin_karp.py b/strings/rabin_karp.py index c1191d47fea3..22da0de80f4c 100644 --- a/strings/rabin_karp.py +++ b/strings/rabin_karp.py @@ -40,7 +40,7 @@ def rabin_karp(pattern, text): return True if i == t_len - p_len: continue - # Calculating the rolling hash + # Calculate the https://en.wikipedia.org/wiki/Rolling_hash text_hash = ( (text_hash - ord(text[i]) * modulus_power) * alphabet_size + ord(text[i + p_len])