Skip to content

Commit a685d22

Browse files
authored
Add Clang format BoyerMoore.java
1 parent 807e668 commit a685d22

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

src/main/java/com/thealgorithms/searches/BoyerMoore.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
package com.thealgorithms.searches;
2+
23
/**
34
* Boyer-Moore string search algorithm
45
* Efficient algorithm for substring search.
5-
*
6-
* @see <a href="https://en.wikipedia.org/wiki/Boyer%E2%80%93Moore_string-search_algorithm">
7-
* https://en.wikipedia.org/wiki/Boyer%E2%80%93Moore_string-search_algorithm</a>
6+
* https://en.wikipedia.org/wiki/Boyer%E2%80%93Moore_string-search-algorithm
87
*/
9-
108
public class BoyerMoore {
119

1210
private final int R;
@@ -17,10 +15,12 @@ public BoyerMoore(String pat) {
1715
this.pattern = pat;
1816
this.R = 256;
1917
this.right = new int[R];
20-
for (int c = 0; c < R; c++)
18+
for (int c = 0; c < R; c++) {
2119
right[c] = -1;
22-
for (int j = 0; j < pat.length(); j++)
20+
}
21+
for (int j = 0; j < pat.length(); j++) {
2322
right[pat.charAt(j)] = j;
23+
}
2424
}
2525

2626
public int search(String text) {
@@ -36,8 +36,9 @@ public int search(String text) {
3636
break;
3737
}
3838
}
39-
if (skip == 0)
39+
if (skip == 0) {
4040
return i;
41+
}
4142
}
4243
return -1;
4344
}

0 commit comments

Comments
 (0)