Skip to content

Commit df601cf

Browse files
ashutosh1598jakobkogler
authored andcommitted
fix sign mistake in prefix function. (#361)
1 parent ad024aa commit df601cf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/string/prefix-function.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ This length cannot be bigger than $n$ due to the separator.
137137
But if equality $\pi[i] = n$ is achieved, then it means that the string $s$ appears completely in at this position, i.e. it ends at position $i$.
138138
Just do not forget that the positions are indexed in the string $s + \\# + t$.
139139

140-
Thus if at some position $i$ we have $\pi[i] = n$, then at the position $i - (n - 1) - n + 1 = i - 2n$ in the string $t$ the string $s$ appears.
140+
Thus if at some position $i$ we have $\pi[i] = n$, then at the position $i - (n + 1) - n + 1 = i - 2n$ in the string $t$ the string $s$ appears.
141141

142142
As already mentioned in the description of the prefix function computation, if we know that the prefix values never exceed a certain value, then we do not need to store the entire string and the entire function, but only its beginning.
143143
In our case this means that we only need to store the string $s + \\#$ and the values of the prefix function for it.

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