Given a text T of length n, the classical indexing problem for pattern matching is to build an index for T so that for any query pattern P, we can report efficiently all occurrences of P in T. Cole et al (2004) extended this problem to allow don't care characters (wildcards) in the text and pattern, and they gave the first index that supports efficient pattern matching. The space complexity of this index is linear in n (text length) but exponential in terms of the number of wildcards. Motivated by bioinformatics applications, we investigate indexes whose size depends on n only. In the literature, space efficient indexes for wildcard matching are known only for the special case when wildcards appear only in the pattern (Iliopoulos and Rahman, 2007); the space required is O(n). Not much has been heard for the case when wildcards appear in the text only, or in both the text and pattern. In this paper we give an O(n) space index to support efficient wildcard matching in all three cases. Our solution to the pattern-only case improves the matching time of the previous work tremendously in practice. In addition, our solution can be extended to handle optional wildcards, each of which can match zero or one character.
[1]
Peter Weiner,et al.
Linear Pattern Matching Algorithms
,
1973,
SWAT.
[2]
Costas S. Iliopoulos,et al.
Finding Patterns with Variable Length Gaps or Don't Cares
,
2006,
COCOON.
[3]
M. Fischer,et al.
STRING-MATCHING AND OTHER PRODUCTS
,
1974
.
[4]
Richard Cole,et al.
Dictionary matching and indexing with errors and don't cares
,
2004,
STOC '04.
[5]
Dan Gusfield,et al.
Algorithms on Strings, Trees, and Sequences - Computer Science and Computational Biology
,
1997
.
[6]
Costas S. Iliopoulos,et al.
Pattern Matching Algorithms with Don't Cares
,
2007,
SOFSEM.
[7]
Edward M. McCreight,et al.
A Space-Economical Suffix Tree Construction Algorithm
,
1976,
JACM.
[8]
Richard M. Karp,et al.
Complexity of Computation
,
1974
.
[9]
Linda Torczon,et al.
An efficient representation for sparse sets
,
1993,
LOPL.