mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-06 17:29:31 +08:00
Add tests for HorspoolSearch (#4165)
This commit is contained in:
@ -100,6 +100,10 @@ public class HorspoolSearch {
|
||||
shiftValues = calcShiftValues(pattern); // build the bad symbol table
|
||||
comparisons = 0; // reset comparisons
|
||||
|
||||
if (pattern.length() == 0) { // return failure, if pattern empty
|
||||
return -1;
|
||||
}
|
||||
|
||||
int textIndex = pattern.length() - 1; // align pattern with text start and get index of the last character
|
||||
|
||||
// while pattern is not out of text bounds
|
||||
|
Reference in New Issue
Block a user