On the Subset Matching
Yangjun Chen · 2006
The subset matching problem is to find all occurrences of a pattern string p of length m in a text string t of length n, where each pattern and text location is a set of characters drawn from some alphabet. The pattern is said to occur at text position i if the set p[j] is a subset of the set t[i + j - 1], for all j (1 \leqslant j \leqslant m). This is an extension of the classic string matching and can be used for finding matching subtree patterns. In this paper, we propose a new algorithm and conduct a probabilistic analysis of its performance, which shows that we need only O(n + m \cdot n^{0.5} ) time to solve the problem on average.