Skip to content

Commit 7d21bea

Browse files
Add Z-Algorithm (string pattern matching) with tests
1 parent 622241e commit 7d21bea

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/test/java/com/thealgorithms/strings/ZAlgorithmTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/*
2+
* https://en.wikipedia.org/wiki/Z-algorithm
3+
*/
14
package com.thealgorithms.strings;
25

36
import static org.junit.jupiter.api.Assertions.*;
@@ -8,7 +11,7 @@ public class ZAlgorithmTest {
811
@Test
912
void testZFunction() {
1013
int[] z = ZAlgorithm.zFunction("aaaaa");
11-
assertArrayEquals(new int[]{0, 4, 3, 2, 1}, z);
14+
assertArrayEquals(new int[] { 0, 4, 3, 2, 1 }, z);
1215
}
1316

1417
@Test

0 commit comments

Comments
 (0)