furious's blog

By furious, 14 years ago, In Russian

I'd be grateful if anyone could explain it to me. Thanks in advance!

  • Vote: I like it
  • +4
  • Vote: I do not like it

»
14 years ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

Actually, you can construct a string with current prefix-function, then calculate its z-function. The way to construct string is following: just iterate through the symbols of alphabet, try to add symbol to current string and check if value of prefix-function is correct — if it really is, just add this symbol to current string, if not — continue iterating. If you can't add any symbol, there's no string with such prefix-function values.