On the average-case complexity of pattern matching with wildcards

被引:1
|
作者
Barton, Carl [1 ]
机构
[1] Birkbeck Univ London, Malet St, London WC1E 7HX, England
关键词
Average case complexity; Pattern matching with wildcards; Stringology; Pattern matching; Pattern matching with don't care symbols;
D O I
10.1016/j.tcs.2022.04.009
中图分类号
TP301 [理论、方法];
学科分类号
081202 ;
摘要
Pattern matching with wildcards is a string matching problem with the goal of finding all factors of a text t of length n that match a pattern x of length m, where wildcards (characters that match everything) may be present. In this paper we present a number of complexity results and fast average-case algorithms for pattern matching where wildcards are allowed in the pattern, however, the results are easily adapted to the case where wildcards are allowed in the text as well. We analyse the average-case complexity of these algorithms and derive non-trivial time bounds. These are the first results on the average-case complexity of pattern matching with wildcards which provide a provable separation in time complexity between exact pattern matching and pattern matching with wildcards. We introduce the wc-period of a string which is the period of the binary mask x(b) where x(b)[i] = a iff x[i] not equal phi and b otherwise. We denote the length of the wc-period of a string x by wcp(x). We show the following results for constant 0 < epsilon < 1 and a pattern xof length m and gwildcards with wcp(x) = p the prefix of length p contains g(p) wildcards: If lim(m ->infinity) g(p)/p= 0 there is an optimal algorithm running in O(nlog(sigma)m/m)-time on average. If lim(m ->infinity) g(p)/p= 1 - epsilon there is an algorithm running in O(nlog(sigma)mlog(2)p/m)-time on average. If lim(m ->infinity) g/m= lim(m ->infinity) 1 - f(m) = 1 any algorithm takes at least Omega(nlog(sigma)m/f(m))-time on average. (C) 2022 The Author(s). Published by Elsevier B.V.
引用
收藏
页码:37 / 45
页数:9
相关论文
共 50 条