Efficient Algorithms for Finding Submasses in Weighted Strings
Authors: Nikhil Bansal, Mark Cieliebak, and Zsuzsanna Lipták
Reference: In "Proceedings of the 15th Annual Combinatorial Pattern Matching Symposium (CPM 2004)". Istanbul, Turkey, July 2004. Springer, LNCS 3109, pp. 194-204, 2004.
Download: Postscript (.ps) or PDF (.pdf)
We study the Submass Finding Problem: Given a string $s$ over a weighted alphabet, i.e., an alphabet $\Sigma$ with a weight function $\mu:\Sigma \to \IN$, decide for an input mass $M$ whether $s$ has a substring whose weights sum up to $M$. If $M$ is indeed a submass, then we want to find one or all occurrences of such substrings. We present efficient algorithms for both the decision and the search problem. Furthermore, our approach allows us to compute efficiently the number of different submasses of $s$.
The main idea of our algorithms is to define appropriate polynomials such that we can determine the solution for the Submass Finding Problem from the coefficients of the product of these polynomials. We obtain very efficient running times by using Fast Fourier Transform to compute this product. Our main algorithm for the decision problem runs in time $O(\stringmass \log \stringmass)$, where $\stringmass$ is the total mass of string $s$. Employing standard methods for compressing sparse polynomials, this runtime can be viewed as $O(\submasses(s) \log^2 \submasses(s))$, where $\submasses(s)$ denotes the number of different submasses of $s$. In this case, the runtime is independent of the size of the individual masses of characters.
Remarks: Link to Springer Online: http://www.springerlink.com/index/V6R1T0LRXC7P999J

Note: electronic versions may not always correspond exactly to printed versions.