On maximal suffixes and constant-space linear-time versions of KMP algorithm
Document Type
Article
Publication Date
4-18-2003
Abstract
Constant-space linear-time string-matching algorithms are usually very sophisticated. Most of them consist of two phases: (very technical) preprocessing phase and searching phase. An exception is one-phase Crochemore's algorithm (Theoret. Comput. Sci. 92 (1992) 33). It is an on-line version of Knuth-Morris-Pratt algorithm (KMP) with "on-the-fly" computation of pattern shifts (as approximate periods). In this paper we explore further Crochemore's approach, and construct alternative algorithms which are differently structured. In Crochemore's algorithm the approximate-period function is restarted from inside, which means that several internal variables of this function are changing globally, also Crochemore's algorithm strongly depends on the concrete implementation of approximate-periods computation. We present a simple modification of KMP algorithm which works in O(1) space, O(n) time for any function which computes periods or approximate periods in O(1)-space and linear time. The approximate-period function can be treated as a black box. We identify class of patterns, self-maximal words, which are especially well suited for Crochemore-style string matching. A new O(1)-space string-matching algorithm, MaxSuffix-Matching, is proposed in the paper, which gives yet another example of applicability of maximal suffixes. © 2002 Elsevier Science B.V. All rights reserved.
Identifier
0037453394 (Scopus)
Publication Title
Theoretical Computer Science
External Full Text Location
https://doi.org/10.1016/S0304-3975(02)00590-X
ISSN
03043975
First Page
763
Last Page
774
Issue
1-3
Volume
299
Recommended Citation
Rytter, Wojciech, "On maximal suffixes and constant-space linear-time versions of KMP algorithm" (2003). Faculty Publications. 14139.
https://digitalcommons.njit.edu/fac_pubs/14139
