Need Help on Z Algorithm

Правка en1, от 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?

Теги #zalgorithm, #strings

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский Ehsan_sShuvo 2016-08-31 17:20:52 529 Initial revision (published)