MCPcopy Create free account
hub / github.com/Seogeurim/CS-study / makeFail

Method makeFail

contents/algorithm/code/KMPTest.java:22–31  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20 }
21
22 static void makeFail() {
23 for (int i = 1, j = 0; i < N; i++) {
24 while (j > 0 && P.charAt(i) != P.charAt(j)) {
25 j = fail[j-1];
26 }
27 if (P.charAt(i) == P.charAt(j)) {
28 fail[i] = ++j;
29 }
30 }
31 }
32
33 static int kmp() {
34 int count = 0;

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected