Skip to content

Given a string of size T, a pattern of size P and an integer k; calculate how many times P appears in T with at most k mismatches.

Notifications You must be signed in to change notification settings

jvtoppa/pattern-mismatch-FFT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Given a string of size T, a pattern of size P and an integer k, calculate how many times P appears in T with at most k mismatches.

This problem is solved through convolutions and the Fourier Transform from complex analysis. The idea is to fix a letter c and write two complex polynomials: one that is the size of the string and one the size of the pattern. By multiplying the Fourier Transforms of the polynomials and then reversing the Transform, we're able to calculate the convolution of a polynomial f. Through the convolution, we can do approximate pattern matching in O(alphabet*NlogN) time with N <= n + m, while a naive approach would result in O(n * m).

About

Given a string of size T, a pattern of size P and an integer k; calculate how many times P appears in T with at most k mismatches.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages