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

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i karp-rabin-search

    Weekly Downloads

    8

    Version

    1.0.6

    License

    MIT

    Last publish

    Collaborators

    • morenoh149