Skip to content

Instantly share code, notes, and snippets.

Avatar

Jose Francisco Saldaña pakosaldanaort

  • Mexico
View GitHub Profile
@pakosaldanaort
pakosaldanaort / Boyer-Moore-Horspool.py
Created Nov 5, 2018
Boyer-Moore-Horspool Python implementation
View Boyer-Moore-Horspool.py
class BoyerMoore:
def __init__(self, text, pattern):
self.text = text
self.pattern = pattern
self.m = len(pattern)
self.n = len(text)
self.skip = []
for i in range(256): self.skip.append(-1)
for i in range(self.m): self.skip[ord(pattern[i])] = self.m