Function
Static Public Summary | ||
public |
Computes for each j the largest 0 <= i < j such that p.slice(0, i) is p.slice(j-i, j). |
Static Public
public build(p: ArrayLike, pi: number, pj: number, t: number[], ti: number) source
import build from '@string-data-structure/longest-prefix-suffix-array/src/build.js'
Computes for each j the largest 0 <= i < j such that p.slice(0, i) is p.slice(j-i, j).
This is the "f[j]" table found in "Fast pattern matching in strings" by Knuth, Morris, and Pratt, although here indices are 0-based hence all indices and inputs are one less than in that paper.