Format code with prettier (#3375)

This commit is contained in:
acbin
2022-10-03 17:23:00 +08:00
committed by GitHub
parent 32b9b11ed5
commit e96f567bfc
464 changed files with 11483 additions and 6189 deletions

View File

@@ -13,7 +13,6 @@ public class StringMatchFiniteAutomata {
public static Scanner scanner = null;
public static void main(String[] args) {
scanner = new Scanner(System.in);
System.out.println("Enter String");
String text = scanner.nextLine();
@@ -26,7 +25,6 @@ public class StringMatchFiniteAutomata {
}
public static void searchPat(String text, String pat) {
int m = pat.length();
int n = text.length();
@@ -46,7 +44,6 @@ public class StringMatchFiniteAutomata {
// Computes finite automata for the partern
public static void computeFA(String pat, int m, int[][] FA) {
for (int state = 0; state <= m; ++state) {
for (int x = 0; x < CHARS; ++x) {
FA[state][x] = getNextState(pat, m, state, x);
@@ -55,7 +52,6 @@ public class StringMatchFiniteAutomata {
}
public static int getNextState(String pat, int m, int state, int x) {
// if current state is less than length of pattern
// and input character of pattern matches the character in the alphabet
// then automata goes to next state
@@ -64,11 +60,8 @@ public class StringMatchFiniteAutomata {
}
for (int ns = state; ns > 0; ns--) {
if (pat.charAt(ns - 1) == x) {
for (int i = 0; i < ns - 1; i++) {
if (pat.charAt(i) != pat.charAt(state - ns + i + 1)) {
break;
}