Dictionary matching with one gap

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

Research output: Chapter in Book/Report/Conference proceedingConference contributionpeer-review

14 Scopus citations


The dictionary matching with gaps problem is to preprocess a dictionary D of d gapped patterns P 1,...,P d over alphabet ∑, where each gapped pattern P i is a sequence of subpatterns separated by bounded sequences of don't cares. Then, given a query text T of length n over alphabet ∑, 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 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(d log d+D) time and O(dlog ε d+D) space, and query time O(n(β-α)loglogd log 2 min { d, log D }+occ), where occ is the number of patterns found, or preprocessing time: O(d2 ovr+ D ), where ovr is the maximal number of subpatterns including each other as a prefix or as a suffix, space: O(d 2+ D ), and query time O(n(β-α)+occ), where occ is the number of patterns found. As far as we know, this is the best solution for this setting of the problem, where many overlaps may exist in the dictionary.

Original languageEnglish
Title of host publicationCombinatorial Pattern Matching - 25th Annual Symposium, CPM 2014, Proceedings
PublisherSpringer Verlag
Number of pages10
ISBN (Print)9783319075655
StatePublished - 2014
Event25th Annual Symposium on Combinatorial Pattern Matching, CPM 2014 - Moscow, Russian Federation
Duration: 16 Jun 201418 Jun 2014

Publication series

NameLecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)
Volume8486 LNCS
ISSN (Print)0302-9743
ISSN (Electronic)1611-3349


Conference25th Annual Symposium on Combinatorial Pattern Matching, CPM 2014
Country/TerritoryRussian Federation

Bibliographical note

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


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

Cite this