Skip to content

Commit c269ccc

Browse files
joaquingxtcNickolas
authored andcommitted
Formula fixes, added practice problem to Z-function (#150)
1 parent e251674 commit c269ccc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/string/z-function.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,11 @@ To do that, we will consider both branches of the algorithm:
162162

163163
Thus, since $z[i-l]$ is correct and it is less than $r - i + 1$, it follows that this value coincides with the required value $z[i]$.
164164

165-
* z_0 = r - i + 1
165+
* $z_0 = r - i + 1$
166166

167167
In this case, the `while` loop can make a few iterations, but each of them will lead to an increase in the value of the $r$ index because we will start comparing from $s[r+1]$, which will climb beyond the $[l; r]$ interval.
168168

169-
* z_0 > r - i + 1
169+
* $z_0 > r - i + 1$
170170

171171
This option is impossible, by definition of $z_0$.
172172

@@ -220,4 +220,5 @@ The proof for this fact does not differ from that of the solution which uses the
220220
* [UVA # 11022 "String Factoring" [Difficulty: Medium]](http://uva.onlinejudge.org/index.php?option=onlinejudge&page=show_problem&problem=1963)
221221
* [UVa 11475 - Extend to Palindrome](http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=2470)
222222
* [LA 6439 - Pasti Pas!](https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&category=588&page=show_problem&problem=4450)
223-
* [Codechef - Chef and Strings](https://www.codechef.com/problems/CHSTR)
223+
* [Codechef - Chef and Strings](https://www.codechef.com/problems/CHSTR)
224+
* [Codeforces - Prefixes and Suffixes](http://codeforces.com/problemset/problem/432/D)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy