z_algorithm
関数 · Z algorithm
template <class Container>
std::vector<int> z_algorithm(const Container &s);
概要
Z algorithm
Z[i] := S[i:Z[i]] == S[0:Z[i]-i]
計算量
- $O(n)$
関数 · Z algorithm
template <class Container>
std::vector<int> z_algorithm(const Container &s);
Z algorithm
Z[i] := S[i:Z[i]] == S[0:Z[i]-i]