English

Optimal pattern matching algorithms

Computational Complexity 2016-05-03 v2 Probability

Abstract

We study a class of finite state machines, called \defi{ww-matching machines}, which yield to simulate the behavior of pattern matching algorithms while searching for a pattern ww. They can be used to compute the asymptotic speed, i.e. the limit of the expected ratio of the number of text accesses to the length of the text, of algorithms while parsing an iid text to find the pattern ww. Defining the order of a matching machine or of an algorithm as the maximum difference between the current and accessed positions during a search (standard algorithms are generally of order w|w|), we show that being given a pattern ww, an order kk and an iid model, there exists an optimal ww-matching machine, i.e. with the greatest asymptotic speed under the model among all the machines of order kk, of which the set of states belongs to a finite and enumerable set. It shows that it is possible to determine: 1) the greatest asymptotic speed among a large class of algorithms, with regard to a pattern and an iid model, and 2) a ww-matching machine, thus an algorithm, achieving this speed.

Keywords

Cite

@article{arxiv.1604.08437,
  title  = {Optimal pattern matching algorithms},
  author = {Gilles Didier},
  journal= {arXiv preprint arXiv:1604.08437},
  year   = {2016}
}
R2 v1 2026-06-22T13:43:31.174Z