Groups
Category
The prefix function π of a string tells, for every position, the length of the longest proper prefix that is also a suffix of the prefix ending there.
The KMP algorithm finds all occurrences of a pattern in a text in O(n + m) time by never re-checking characters that are already known to match or mismatch.