Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- zAlgorithm :: ByteString -> Vector Int
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 ""
[]