Algoritmos de correspondência de strings rápidos e de tempo linear baseados nas distâncias de ocorrências de gramas q
Fast and linear-time string matching algorithms based on the distances of q-gram occurrences
Fast and linear-time string matching algorithms based on the distances of q-gram occurrences
@misc{kobayashi2020fast,
title = {Fast and linear-time string matching algorithms based on the distances of q-gram occurrences},
author = {Satoshi Kobayashi and Diptarama Hendrian and Ryo Yoshinaka and Ayumi Shinohara},
year = {2020},
eprint = {2002.08004},
archivePrefix = {arXiv},
primaryClass = {cs.DS},
url = {https://arxiv.org/abs/2002.08004}
}
Kobayashi, S., Hendrian, D., Yoshinaka, R., & Shinohara, A. (2020). Fast and linear-time string matching algorithms based on the distances of q-gram occurrences [Preprint]. arXiv. https://doi.org/10.48550/arXiv.2002.08004
KOBAYASHI S, HENDRIAN D, YOSHINAKA R, et al. Fast and linear-time string matching algorithms based on the distances of q-gram occurrences[EB/OL]. (2020-02-19)[2026-11-30]. https://arxiv.org/abs/2002.08004.
Resumo
Dado um texto T de comprimento n e um padrão P de comprimento m, o problema de correspondência de strings é a tarefa de encontrar todas as ocorrências de P em T. Neste estudo, propomos um algoritmo que resolve este problema em tempo O((n + m)q) considerando a distância entre duas ocorrências adjacentes do mesmo q-grama contido em P. Também propomos uma melhoria teórica deste algoritmo que opera em tempo O(n + m), embora não seja necessariamente mais rápida na prática. Comparamos os tempos de execução dos nossos e dos algoritmos existentes em diversos conjuntos de dados reais e artificiais, como um texto em inglês, uma sequência genômica e uma string de Fibonacci. Os resultados experimentais mostram que nosso algoritmo é tão rápido quanto os algoritmos do estado da arte em muitos casos, particularmente quando um padrão aparece com frequência em um texto.
Given a text T of length n and a pattern P of length m, the string matching problem is a task to find all occurrences of P in T. In this study, we propose an algorithm that solves this problem in O((n + m)q) time considering the distance between two adjacent occurrences of the same q-gram contained in P. We also propose a theoretical improvement of it which runs in O(n + m) time, though it is not necessarily faster in practice. We compare the execution times of our and existing algorithms on various kinds of real and artificial datasets such as an English text, a genome sequence and a Fibonacci string. The experimental results show that our algorithm is as fast as the state-of-the-art algorithms in many cases, particularly when a pattern frequently appears in a text.