Example #1
0
 def test_rabin_karp(self):
     self.assertEqual(3, rabin_karp("abc", "zsnabckfkd"))
     self.assertEqual(None, rabin_karp("abc", "zsnajkskfkd"))
Example #2
0
 def test_rabin_karp(self):
     self.assertEqual(3, rabin_karp("abc", "zsnabckfkd"))
     self.assertEqual(None, rabin_karp("abc", "zsnajkskfkd"))
###  XXXX
from algorithms.strings import rabin_karp
###
txt = "GEEKS FOR GEEKS"
pat = "GEEK"

a="ABAAABCDBBABCDDEBCABC"
b="ABC"

print(rabin_karp(txt,pat))

print(rabin_karp(a,b))