iota-0.1.0.0
Safe HaskellSafe-Inferred
LanguageGHC2021

Data.ByteString.ZAlgorithm

Synopsis

Documentation

zAlgorithm :: ByteString -> Vector Int Source #

z[i] = lcp s $ drop i s

time complexity: O(n)

>>> :set -XOverloadedStrings
>>> zAlgorithm "ababab"
[6,0,4,0,2,0]
>>> zAlgorithm "abc$xabcxx"
[10,0,0,0,0,3,0,0,0,0]
>>> zAlgorithm ""
[]