Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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‎

Lines changed: 3 additions & 3 deletions
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)

AltStyle によって変換されたページ (->オリジナル) /