[ Web Proxy ]
URL:
Viewing: https://string-data-structure.github.io/failure-function/function/index.html#static-function-build [Back]  [Original]

Function | @string-data-structure/failure-function Home Manual Reference Source github.png [github.png]

Function

Static Public Summary
public

build(p: ArrayLike, pi: number, pj: number, t: number[], ti: number)

Computes the failure function for input string.

Static Public

public build(p: ArrayLike, pi: number, pj: number, t: number[], ti: number) source

Computes the failure function for input string.

This is the "next[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.

NOTE The main loop is somewhat unrolled for faster execution. This was not benchmarked.

Params:

NameTypeAttributeDescription
p ArrayLike
pi number
pj number
t number[]
ti number
Generated by ESDoc(1.1.0)esdoc-logo-mini-black.png [esdoc-logo-mini-black.png]
Web Proxy Viewer  |  New URL  |  Original Page