File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
2
*
3
3
*
4
- *Implementation of the Boyer-Moore String Search Algo .
4
+ *Implementation of the Boyer-Moore String Search Algorithm .
5
5
*The Boyer–Moore string search algorithm allows linear time in
6
- * search by skipping
7
- * indices when searching inside a string for a pattern.
6
+ *search by skipping indices when searching inside a string for a pattern.
8
7
*
9
8
*
10
9
*
@@ -39,10 +38,10 @@ const boyerMoore = (str, pattern) => {
39
38
}
40
39
const badMatchString = str [ offset + patternLastIndex ]
41
40
if ( badMatchTable [ badMatchString ] ) {
42
- // increase the offset if it exists
41
+ // increase the offset if it exists
43
42
offset += badMatchTable [ badMatchString ]
44
43
} else {
45
- offset += 1
44
+ offset ++
46
45
}
47
46
}
48
47
return - 1
You can’t perform that action at this time.
0 commit comments