Commit a4db14b
committed
Fix Boyer-Moore bad character shift to use while loop
The bad_character_heuristic method was reassigning the for-loop variable
'i' inside a for loop, which has no effect in Python. This caused the
bad character shift to be ignored, making the algorithm behave as O(nm)
brute-force instead of O(n/m).
Fix: Replace for loop with while loop to allow the shift to take effect.
Fixes #148441 parent e3b01ec commit a4db14b
1 file changed
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
| 89 | + | |
| 90 | + | |
90 | 91 | | |
91 | 92 | | |
92 | 93 | | |
| 94 | + | |
93 | 95 | | |
94 | 96 | | |
95 | | - | |
96 | | - | |
97 | | - | |
| 97 | + | |
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| |||
0 commit comments