diff options
Diffstat (limited to 'ass1/binary_boyermoore.py')
| -rw-r--r-- | ass1/binary_boyermoore.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ass1/binary_boyermoore.py b/ass1/binary_boyermoore.py index a75b9b2..b42cff7 100644 --- a/ass1/binary_boyermoore.py +++ b/ass1/binary_boyermoore.py @@ -142,6 +142,8 @@ def boyer_moore(pat, txt): good_suffix_shift = m - matched_prefix[1] # print(start, stop) j += max(good_suffix_shift, bad_char_shift) + if good_suffix_shift >= bad_char_shift: + print("good suff", good_suffix_shift) if good_suffix[i+1] >= 0 and good_suffix_shift >= bad_char_shift: galil_index = j break @@ -151,4 +153,4 @@ def boyer_moore(pat, txt): for i, a in enumerate(R): print(chr(i+97), a) -boyer_moore("abcdxxxabcd", "zzzzzzabcdxxxaaabcdxxxabcdabcdxxxabcdabcdxxxabcdabcdxxxabcdbcdabcdxxxabcdabcdxxxabcdabcdxxxabcdxxxabcdabcdxxxabcdabcdxxxabcdabcdxxxabcdabcdxxxabcdbcdabcdxxxabcdzzzzabcdxxxabcdabcdxxxabcdzabcdxxxabcdzzzzzzzzzz")
\ No newline at end of file +boyer_moore("xoxxxo", "xooxxoxoxoxoxoxoxxxoxxoxxxoxxoooxxxoxxxoxxxox")
\ No newline at end of file |
