This algorithm finds all occurrences of a pattern in a text in linear time. Let length of text be n and of pattern be m, then total time taken is O(m + n) with linear space complexity.
Now we can see that both time and space complexity is same as KMP algorithm but this algorithm is Simpler to understand.
npm install z-algorithm --save
or
yarn install z-algorithm
you need to install jest
npm test
or
yarn test
import z from 'z-algorithm';
let result = z.search('Hello World', 'Hello');
import z from 'z-algorithm';
kerim selmi karimation
This project is licensed under the MIT License