Abstract. We study the Submass Finding Problem: Given a string s over a weighted alphabet, i.e., an alphabet Σ with a weight function μ : Σ → N, 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 Prob- lem 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(μs log μs), where μs is the total mass of string s. Employing stan- dard methods for compressing sparse polynomials, this runtime can be viewed as O(σ(s) log2 σ(s)), where σ(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.
File in questo prodotto:
Non ci sono file associati a questo prodotto.