Skip to content

Commit c1b47dc

Browse files
Update example in preamble
1 parent ae9dfd2 commit c1b47dc

File tree

1 file changed

+3
-3
lines changed
  • src/_Classics_/knuth-morris-pratt

1 file changed

+3
-3
lines changed

src/_Classics_/knuth-morris-pratt/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11

22
/* *
33
* The time complexity of KMP algorithm is O(n) in the worst case
4-
* Example use case: Pattern = AABCAB Text = AAABACABAABCABAABCA
5-
* LPSArray = [ 0, 0, 1, 2, 3, 0 ]
6-
* Found = true, at position 13
4+
* Example use case: Pattern = ABCABCACA Text = AAABCBAABCABCACACABBCA
5+
* LPSArray = [ 0, 0, 0, 1, 2, 3, 4, 0, 1 ]
6+
* Found = true, at index 7
77
* */
88

99
// Longest prefix suffix - generate an array of the lps for each pattern array value

0 commit comments

Comments
 (0)