GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Home
  • Manual
  • Reference
  • Source
  • build

This view

  • Original page
  • New address

GeezerVison is showing string-data-structure.github.io — Function | @string-data-structure/failure-function

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

import build from '@string-data-structure/failure-function/src/build.js'

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
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.