haccepted-0.1.0.0: Data structures and algorithms
Safe HaskellNone
LanguageHaskell2010

ZFunc

Description

Z-function

A string matching algorithm. The Z-algorithm generates the function z from a string s, where z(i) is the length of the longest prefix of s that starts at i. z[0] is set to 0.

Sources:

Synopsis

Documentation

zFunc :: Eq a => Int -> (Int -> a) -> UArray Int Int Source #

Constructs the Z-function. The input sequence should be 0-indexed. O(n).

zFuncBS :: ByteString -> UArray Int Int Source #

zFunc for a ByteString. O(n).