Skip to content

Commit 4594ece

Browse files
committed
KMP: Minor update to docs to improve clarity
1 parent 7afe680 commit 4594ece

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/algorithms/patternFinding/KMP.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
* there is no prefix ending before its index, 0, that can be matched with.
1818
* Read: ^ ^ 'B' and 'C' cannot be matched with any prefix which are just 'A' and 'AB' respectively.
1919
* Read: ^ Can be matched with an earlier 'A'. So we store 1.
20-
* Prefix is the substring from idx 0 to 1 (exclusive).
21-
* Which can also be interpreted as the index of the next character to match against!
20+
* Prefix is the substring from idx 0 to 1 (exclusive). Note consider prefix from 0-indexed.
21+
* Realise 1 can also be interpreted as the index of the next character to match against!
2222
* Read: ^ ^ Similarly, continue matching
2323
* Read: ^ ^ No matches, so 0
2424
* Read: ^ ^ ^ ^ ^ ^ Match with prefix until position 6!

0 commit comments

Comments
 (0)