Dictionary matching with a few gaps

Amihood Amir, Avivit Levy, Ely Porat, B. Riva Shalom

Research output: Contribution to journalArticlepeer-review

15 Scopus citations

Abstract

The dictionary matching with gaps problem is to preprocess a dictionary D of total size |D| containing d gapped patterns P1, ..., Pd over an alphabet σ, where each gapped pattern Pi is a sequence of subpatterns separated by bounded sequences of don't cares. Then, given a query text T of length n over σ, the goal is to output all locations in T in which a pattern Pi∈D, 1≤i≤d, ends. There is a renewed current interest in the gapped matching problem stemming from cyber security. In this paper we solve the problem where all patterns in the dictionary have one gap or a few gaps with at least α and at most β don't cares, where α and β are given parameters. Specifically, we show that the dictionary matching with a single gap problem can be solved in either O(dlogd+|D|) preprocessing time and O(dlogεd+|D|) space, and query time O(n(β-α)loglogdlog2|D|+occ), where occ is the number of patterns found, or preprocessing time and space: O(d2+|D|), and query time O(n(β-α)+occ), where occ is the number of patterns found. We also show that the dictionary matching with k gaps problem, where k≥1, can be solved in preprocessing time: O(|D|log|D|), space: O(|D|+d(c1logd)kk!), and query time: O((β-α)k(n+(c2logd)kk!loglog|D|)+occ), where c1, c2>1 are constants and occ is the number of patterns found. As far as we know, these are the best solutions for this setting of the problem, where many overlaps may exist in the dictionary.

Original languageEnglish
Pages (from-to)34-46
Number of pages13
JournalTheoretical Computer Science
Volume589
DOIs
StatePublished - 19 Jul 2015

Bibliographical note

Publisher Copyright:
© 2015 Elsevier B.V.

Funding

This research was supported by the Kabarnit Cyber consortium funded by the Chief Scientist in the Israeli Ministry of Economy under the Magnet Program.

FundersFunder number
Israeli Ministry of Economy

    Keywords

    • Dictionary matching
    • Gapped patterns
    • String matching

    Fingerprint

    Dive into the research topics of 'Dictionary matching with a few gaps'. Together they form a unique fingerprint.

    Cite this