## Abstract

The dictionary matching with gaps problem is to preprocess a dictionary D of total size |D| containing d gapped patterns P_{1}, ..., P_{d} over an 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 σ, the goal is to output all locations in T in which a pattern P_{i}∈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(β-α)loglogdlog^{2}|D|+occ), where occ is the number of patterns found, or preprocessing time and space: O(d^{2}+|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 c_{1}, c_{2}>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 language | English |
---|---|

Pages (from-to) | 34-46 |

Number of pages | 13 |

Journal | Theoretical Computer Science |

Volume | 589 |

DOIs | |

State | Published - 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.

Funders | Funder number |
---|---|

Israeli Ministry of Economy |

## Keywords

- Dictionary matching
- Gapped patterns
- String matching