Pseudo-realtime Pattern Matching: Closing the Gap

  • Raphaël Clifford
  • Benjamin Sach
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6129)


We consider the k-difference and k-mismatch problems in the pseudo-realtime model where the text arrives online and the time complexity measure is per arriving character and unamortised. The well-known k-difference/k-mismatch problems are those of finding all alignments of a pattern of length m with a text of length n where the edit/Hamming distance is at most k. Offline, the literature gives efficient solutions in O(nk) and \(O(n \sqrt{k \log k})\) time, respectively. More recently, a pseudo-realtime solution was given for the former in O(k logm) time and the latter in \(O(\sqrt{k \log k}\log m)\) time per arriving text character. Our work improves these complexities to O(k) time for the k-difference problem and \(O(\sqrt{k}\log k + \log m)\) for the k-mismatch problem. In the process of developing the main results, we also give a simple solution with optimal time complexity for performing longest common extension queries in the same pseudo-realtime setting which may be of independent interest.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Abrahamson, K.R.: Generalized string matching. SIAM J. Comput. 16(6), 1039–1051 (1987)zbMATHCrossRefMathSciNetGoogle Scholar
  2. 2.
    Amir, A., Lewenstein, M., Porat, E.: Faster algorithms for string matching with k mismatches. In: SODA 2000, pp. 794–803 (2000)Google Scholar
  3. 3.
    Clifford, R., Efremenko, K., Porat, B., Porat, E.: A black box for online approximate pattern matching. In: Ferragina, P., Landau, G.M. (eds.) CPM 2008. LNCS, vol. 5029, pp. 143–151. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  4. 4.
    Clifford, R., Sach, B.: Online approximate matching with non-local distances. In: Kucherov, G., Ukkonen, E. (eds.) CPM 2009. LNCS, vol. 5577, pp. 142–153. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  5. 5.
    Galil, Z.: String matching in real time. Journal of the ACM 28(1), 134–149 (1981)zbMATHCrossRefMathSciNetGoogle Scholar
  6. 6.
    Kosaraju, S.R.: Efficient string matching (1987) (manuscript)Google Scholar
  7. 7.
    Landau, G.M., Myers, E.W., Schmidt, J.P.: Incremental string comparison. SIAM J. Comput. 27(2), 557–582 (1998)zbMATHCrossRefMathSciNetGoogle Scholar
  8. 8.
    Landau, G.M., Vishkin, U.: Fast string matching with k differences. J. Comput. Syst. Sci. 37(1), 63–78 (1988)zbMATHCrossRefMathSciNetGoogle Scholar
  9. 9.
    Manber, U., Myers, G.: Suffix arrays: a new method for on-line string searches. In: SODA 1990, pp. 319–327 (1990)Google Scholar
  10. 10.
    Porat, E., Porat, B.: Exact and approximate pattern matching in the streaming model. In: FOCS 2009, pp. 315–323 (2009)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2010

Authors and Affiliations

  • Raphaël Clifford
    • 1
  • Benjamin Sach
    • 1
  1. 1.Department of Computer ScienceUniversity of BristolUK

Personalised recommendations