%0 Journal Article %T Designing optimal-and fast-on-average pattern matching algorithms %+ Institut de Mathématiques de Marseille (I2M) %A Didier, Gilles %A Tichit, Laurent %< avec comité de lecture %@ 1570-8667 %J Journal of Discrete Algorithms %I Elsevier %V 42 %P 45-60 %8 2017-01 %D 2017 %Z 1604.08860 %Z Computer Science [cs]/Computational Complexity [cs.CC]Journal articles %X Given a pattern w and a text t, the speed of a pattern matching algorithm over t with regard to w, is the ratio of the length of t to the number of text accesses performed to search w into t. We first propose a general method for computing the limit of the expected speed of pattern matching algorithms, with regard to w, over iid texts. Next, we show how to determine the greatest speed which can be achieved among a large class of algorithms, altogether with an algorithm running this speed. Since the complexity of this determination make it impossible to deal with patterns of length greater than 4, we propose a polynomial heuristic. Finally, our approaches are compared with 9 pre-existing pattern matching algorithms from both a theoretical and a practical point of view, i.e. both in terms of limit expected speed on iid texts, and in terms of observed average speed on real data. In all cases, the pre-existing algorithms are outperformed. %G English %2 https://hal.science/hal-01310165/document %2 https://hal.science/hal-01310165/file/Optimal.pdf %L hal-01310165 %U https://hal.science/hal-01310165 %~ CNRS %~ UNIV-AMU %~ EC-MARSEILLE %~ I2M %~ I2M-2014-