Grammar-Based Construction of Indexes for Binary Jumbled Pattern Matching
arXiv:1210.8386
Abstract
We show how, given a straight-line program with rules for a binary string of length , in time we can build a linear-space index such that, given and , in O(1) time we can determine whether there is a substring of with length containing exactly copies of 1. If we use space for the index, then we can list all such substrings using time per substring.