We study the Longest Common Extension (LCE) problem in a string containing wildcards. Wildcards (also called “don’t cares” or “holes”) are special characters that match any other character in the alphabet, similar to the character “?” in Unix commands or “.” in regular expression engines. We consider the problem parametrized by , the number of maximal contiguous groups of wildcards in the input string. Our main contribution is a simple data structure for this problem that can be built in time, occupies space, and answers queries in time, for any . Up to the factor, this interpolates smoothly between the data structure of Crochemore et al. [JDA 2015], which has preprocessing time and space, and query time, and a simple solution based on the “kangaroo jumping” technique [Landau and Vishkin, STOC 1986], which has preprocessing time and space, and query time. By establishing a connection between this problem and Boolean matrix multiplication, we show that our solution is optimal, up to subpolynomial factors, among combinatorial data structures when under a widely believed hypothesis. In addition, we develop a simple deterministic combinatorial algorithm for sparse Boolean matrix multiplication. We further establish a conditional lower bound for non-combinatorial data structures, stating that preprocessing time (resp. space) is optimal, up to subpolynomial factors, for any data structure with query time for a wide range of and , assuming the well-established (resp. ) conjecture. Finally, we show that our data structure can be used to obtain efficient algorithms for approximate pattern matching and structural analysis of strings with wildcards.

生成讲解博客的中文版本

生成AI智能校验的中文版本