Algoritmos de coincidencia de cadenas rápidos y de tiempo lineal basados en las distancias de las ocurrencias de q-gramas
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.
Resumen
Dada una cadena T de longitud n y un patrón P de longitud m, el problema de coincidencia de cadenas es la tarea de encontrar todas las ocurrencias de P en T. En este estudio, proponemos un algoritmo que resuelve este problema en tiempo O((n + m)q) considerando la distancia entre dos ocurrencias adyacentes del mismo q-grama contenida en P. También proponemos una mejora teórica que ejecuta en tiempo O(n + m), aunque no necesariamente es más rápida en la práctica. Comparamos los tiempos de ejecución de nuestro algoritmo y de los algoritmos existentes en diversos conjuntos de datos reales y artificiales, como un texto en inglés, una secuencia genómica y una cadena de Fibonacci. Los resultados experimentales muestran que nuestro algoritmo es tan rápido como los algoritmos del estado del arte en muchos casos, especialmente cuando un patrón aparece con frecuencia en un 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.