mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-08-02 23:00:35 +08:00
Format code with prettier (#3375)
This commit is contained in:
@ -13,7 +13,6 @@ public class RabinKarp {
|
||||
public static final int d = 256;
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
scanner = new Scanner(System.in);
|
||||
System.out.println("Enter String");
|
||||
String text = scanner.nextLine();
|
||||
@ -25,7 +24,6 @@ public class RabinKarp {
|
||||
}
|
||||
|
||||
private static void searchPat(String text, String pattern, int q) {
|
||||
|
||||
int m = pattern.length();
|
||||
int n = text.length();
|
||||
int t = 0;
|
||||
@ -45,7 +43,6 @@ public class RabinKarp {
|
||||
}
|
||||
|
||||
for (i = 0; i <= n - m; i++) {
|
||||
|
||||
// if the calculated hash value of the pattern and text matches then
|
||||
// all the characters of the pattern is matched with the text of length equal to length of the
|
||||
// pattern
|
||||
@ -54,10 +51,8 @@ public class RabinKarp {
|
||||
// of the next character after the end
|
||||
// of the evaluated characters is added
|
||||
if (p == t) {
|
||||
|
||||
// if hash value matches then the individual characters are matched
|
||||
for (j = 0; j < m; j++) {
|
||||
|
||||
// if not matched then break out of the loop
|
||||
if (text.charAt(i + j) != pattern.charAt(j)) {
|
||||
break;
|
||||
|
Reference in New Issue
Block a user