A LEFT-TO-RIGHT PREPROCESSING COMPUTATION FOR THE BOYER-MOORE STRING-MATCHING ALGORITHM

Authors
Citation
T. Takaoka, A LEFT-TO-RIGHT PREPROCESSING COMPUTATION FOR THE BOYER-MOORE STRING-MATCHING ALGORITHM, Computer journal, 39(5), 1996, pp. 413-416
Citations number
11
Categorie Soggetti
Computer Sciences","Computer Science Hardware & Architecture
Journal title
ISSN journal
00104620
Volume
39
Issue
5
Year of publication
1996
Pages
413 - 416
Database
ISI
SICI code
0010-4620(1996)39:5<413:ALPCFT>2.0.ZU;2-C
Abstract
The string matching algorithm is generally divided into two phases: th e preprocessing phase to obtain the shift tables and the main matching process with the tables. In the off-line version, we computed the tab les after the whole pattern has been input, while in the on-line versi on, we computed the tables as the new character of the pattern is inpu t, that is, on the fly. The shift table for the Knuth-Morris-Pratt (KM P) is computed from left to right, and hence suitable for the on-line version. The d-table and Horspool table in the Boyer-Moore (BM) algori thm are also computed from left to right in linear time. We show in th is paper that the dd-table for the BM algorithm can be computed in O(m log m) expected time from left to right for a random pattern, and hen ce can be incorporated into an on-line version.