karp-rabin-search

1.0.6 • Public • Published

Rabin Karp Search Algorithm

A Javascript implementation of the Rabin-Karp Algorithm.

It can be used for detecting occurrences of a string in another string. Can be used to detect plagiarism. Note I advise not to use this algo, iteratively calling indexOf yields better performance in V8.

Usage

npm install

var rks = require('rabin-karp-search')

rks.search('There is a pattern in this string', 'pattern') // prints [ 11 ]
rks.search('A pattern and another pattern', 'pattern') // prints [ 2, 22 ]

Tests

run npm test

Dependencies

https://github.com/rsandor/number-theory

License

MIT

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.6
    1
    • latest

Version History

Package Sidebar

Install

npm i karp-rabin-search

Weekly Downloads

1

Version

1.0.6

License

MIT

Last publish

Collaborators

  • morenoh149