English

Longest common substrings with k mismatches

Data Structures and Algorithms 2015-04-08 v2

Abstract

The longest common substring with kk-mismatches problem is to find, given two strings S1S_1 and S2S_2, a longest substring A1A_1 of S1S_1 and A2A_2 of S2S_2 such that the Hamming distance between A1A_1 and A2A_2 is k\le k. We introduce a practical O(nm)O(nm) time and O(1)O(1) space solution for this problem, where nn and mm are the lengths of S1S_1 and S2S_2, respectively. This algorithm can also be used to compute the matching statistics with kk-mismatches of S1S_1 and S2S_2 in O(nm)O(nm) time and O(m)O(m) space. Moreover, we also present a theoretical solution for the k=1k = 1 case which runs in O(nlogm)O(n \log m) time, assuming mnm\le n, and uses O(m)O(m) space, improving over the existing O(nm)O(nm) time and O(m)O(m) space bound of Babenko and Starikovskaya.

Keywords

Cite

@article{arxiv.1409.1694,
  title  = {Longest common substrings with k mismatches},
  author = {Tomas Flouri and Emanuele Giaquinta and Kassian Kobert and Esko Ukkonen},
  journal= {arXiv preprint arXiv:1409.1694},
  year   = {2015}
}

Comments

Accepted version

R2 v1 2026-06-22T05:49:19.236Z