Applying the KMP Failure Function

Numerous KMP articles mention that the failure function in KMP itself has a large number of applications.

One of these applications is to search for the smallest string, which, when combined, gives the original string (period) k times.

But I could not find another. What other problems are related to the KMP failure function?

+5
source share
1 answer

KMP calculates the boundaries of all string prefixes, which themselves are a key concept in the string algorithm. (Computing the boundary of an entire word is itself nontrivial, and KMP (rejection function) is the standard for this!)

The border s is simply any word that is both the prefix and suffix s.

, w , k w ^ k = s s. s.

. s - w s, s wwww... , abc - abcabcab. , 1:1 ; , abcab abcabcab. , w s, , s w (w ^ -1 s), s. , w s, , s, w, s.

. , , () ; . .

+3

All Articles