File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
src/main/java/com/packt/datastructuresandalg/lesson5/activity/boyermoore/solution Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -9,15 +9,15 @@ public List<Integer> match(String P, String T) {
99 int m = P .length ();
1010
1111 int e = 256 ;
12- int right [][] = new int [m ][e ];
12+ int left [][] = new int [m ][e ];
1313 for (int i = 0 ; i < m ; i ++)
1414 for (int j = 0 ; j < e ; j ++)
15- right [i ][j ] = -1 ;
15+ left [i ][j ] = -1 ;
1616 for (int i = 0 ; i < m ; i ++) {
1717 if (i != 0 )
1818 for (int j = 0 ; j < e ; j ++)
19- right [i ][j ] = right [i - 1 ][j ];
20- right [i ][P .charAt (i )] = i ;
19+ left [i ][j ] = left [i - 1 ][j ];
20+ left [i ][P .charAt (i )] = i ;
2121 }
2222
2323 int i = m , j = m + 1 ;
@@ -50,7 +50,7 @@ public List<Integer> match(String P, String T) {
5050 for (j = m - 1 ; j >= 0 ; j --) {
5151 if (P .charAt (j ) != T .charAt (i + j )) {
5252 hasMatch = false ;
53- skip = Math .max (s [j + 1 ], j - right [j ][T .charAt (i + j )]);
53+ skip = Math .max (s [j + 1 ], j - left [j ][T .charAt (i + j )]);
5454 break ;
5555 }
5656 }
You can’t perform that action at this time.
0 commit comments