Need Help on Z Algorithm

Revision en1, by Ehsan_sShuvo, 2016-08-31 17:20:52

why in Z algorithm substring length is bound-1? please,explain this anyone.

Z[k] would be longest substring starting at k which is also prefix of the string. Now R-i + 1 gives the length of remaining characters in the Z box. Since we copy the value of Z[k] to optimize the calculation of Z values we need to check whether these values are inside the boundary of the Z box

Why not we calculate the remaining part including k index?K index is in the substring,so why skip this index?

Tags #zalgorithm, #strings

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Ehsan_sShuvo 2016-08-31 17:20:52 529 Initial revision (published)