Help with Z algorithm without sentinel

Правка en1, от binary_eagle, 2015-12-26 00:23:42

Hi guys,

I am familiar with the Z algorithm for exact string matching.

However, is there a way to do this without using the sentinel

which is commonly #?

An idea i have is if m is the length of the pattern and n the length of the text, then we can do this

let S = P+T compute Z table

since the pattern is of length n, start iterating from i = m to i = n+m-1 if Z[i] >= m then we have a match at i. Is this correct?

Теги string matching, z algorithm, kmp, string algorithms

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский binary_eagle 2015-12-26 00:23:42 476 Initial revision (published)