kmp: Motivated by HW1, realize KMP algorithm to find times of...

Description Usage Arguments Value Examples

View source: R/mypackage.R

Description

Motivated by HW1, realize KMP algorithm to find times of appearance of x in y, especially for quite long vectors matching

Usage

1
kmp(x, y)

Arguments

x

a vector

y

a vector

Value

times of appearance of x in y

Examples

1
2
kmp(c(1,2),c(1,2,1,2,3))
kmp(c(1,1),c(1,1,1,1,1))

miraclethief/hw4 documentation built on Dec. 21, 2021, 6:58 p.m.