Tags

15

Total

Z algorithm - string searching

Assume that we have a string s of length n. Z algorithm runs in linear time O(n) to calculate the lengths of the longest substringd starting from s[i] (i=0, 1...n-1) which is also a prefix of s[0..n-1......