1
0
mirror of https://github.com/dholerobin/Lecture_Notes.git synced 2025-03-16 14:19:58 +00:00

Update Z-algorithm.md

This commit is contained in:
Aakash Panchal 2020-06-04 02:51:41 +05:30 committed by GitHub
parent 36220d6836
commit 56c6697bb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -128,7 +128,7 @@ For example, `p = "ab"` and `s = "abbbabab"`, then Z-algorithm will find us `[0,
Basic idea here is to create a new string having $p$ as a prefix and $s$ as a suffix i.e. `new_str = p + '#' + s`.
**To make sure that the value of Z-function does not exceed the length of $p$, we will add character which is never going to appear in string $s$**.
**To make sure that the value of Z-function does not exceed the length of $p$, we add a character which is never going to appear in string $s$ like `'#'`**.
Now, we will find Z-function of `new_str`.