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.
초록
문장 T의 길이가 n이고 패턴 P의 길이가 m일 때, 문자열 매칭 문제는 T 내에서 P의 모든 발생 위치를 찾는 작업입니다. 본 연구에서는 P 내의 동일한 q-그램 인접 발생 간격을 고려하여 O((n + m)q) 시간 내에 이 문제를 해결하는 알고리즘을 제안합니다. 또한 실용적 속도 향상은 보장하지 않더라도 O(n + m) 시간으로 실행되는 이론적 개선안을 제시합니다. 영어 텍스트, 유전체 시퀀스, 피보나치 문자열 등 다양한 실제 및 인공 데이터셋에서 제안한 알고리즘과 기존 알고리즘의 실행 시간을 비교 분석했습니다. 실험 결과는 많은 경우, 특히 패턴이 텍스트에서 빈번하게 나타나는 경우 제안한 알고리즘이 최첨단 알고리즘과 동등한 속도를 보인다는 것을 보여줍니다.
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.