Table of Contents
Fetching ...

The Fine-Grained Complexity of Episode Matching

Philip Bille, Inge Li Gørtz, Shay Mozes, Teresa Anna Steiner, Oren Weimann

TL;DR

This paper establishes fine-grained complexity results for Episode Matching, proving that no $O((nm)^{1-\\epsilon})$ algorithm exists under OVH/SETH even for binary alphabets, thereby explaining the quadratic barrier. It then provides a tunable time-space tradeoff for Episode Matching indexing, achieving space $O(n+(n/\\tau)^k)$ and query time $O(k\\tau\\log\\log n)$, with an almost matching lower bound based on the $k$-Set Disjointness Conjecture. For the special case $k=2$, it offers faster preprocessing and query-time regimes via min-plus multiplication of bounded-integer matrices. Overall, the results delineate tight (up to polylog factors) boundaries for both the decision problem and the indexing variant, highlighting the role of alphabet size and fundamental hardness conjectures in string pattern problems.

Abstract

Given two strings $S$ and $P$, the Episode Matching problem is to find the shortest substring of $S$ that contains $P$ as a subsequence. The best known upper bound for this problem is $\tilde O(nm)$ by Das et al. (1997) , where $n,m$ are the lengths of $S$ and $P$, respectively. Although the problem is well studied and has many applications in data mining, this bound has never been improved. In this paper we show why this is the case by proving that no $O((nm)^{1-ε})$ algorithm (even for binary strings) exists, unless the Strong Exponential Time Hypothesis (SETH) is false. We then consider the indexing version of the problem, where $S$ is preprocessed into a data structure for answering episode matching queries $P$. We show that for any $τ$, there is a data structure using $O(n+\left(\frac{n}τ\right)^k)$ space that answers episode matching queries for any $P$ of length $k$ in $O(k\cdot τ\cdot \log \log n )$ time. We complement this upper bound with an almost matching lower bound, showing that any data structure that answers episode matching queries for patterns of length $k$ in time $O(n^δ)$, must use $Ω(n^{k-kδ-o(1)})$ space, unless the Strong $k$-Set Disjointness Conjecture is false. Finally, for the special case of $k=2$, we present a faster construction of the data structure using fast min-plus multiplication of bounded integer matrices.

The Fine-Grained Complexity of Episode Matching

TL;DR

This paper establishes fine-grained complexity results for Episode Matching, proving that no algorithm exists under OVH/SETH even for binary alphabets, thereby explaining the quadratic barrier. It then provides a tunable time-space tradeoff for Episode Matching indexing, achieving space and query time , with an almost matching lower bound based on the -Set Disjointness Conjecture. For the special case , it offers faster preprocessing and query-time regimes via min-plus multiplication of bounded-integer matrices. Overall, the results delineate tight (up to polylog factors) boundaries for both the decision problem and the indexing variant, highlighting the role of alphabet size and fundamental hardness conjectures in string pattern problems.

Abstract

Given two strings and , the Episode Matching problem is to find the shortest substring of that contains as a subsequence. The best known upper bound for this problem is by Das et al. (1997) , where are the lengths of and , respectively. Although the problem is well studied and has many applications in data mining, this bound has never been improved. In this paper we show why this is the case by proving that no algorithm (even for binary strings) exists, unless the Strong Exponential Time Hypothesis (SETH) is false. We then consider the indexing version of the problem, where is preprocessed into a data structure for answering episode matching queries . We show that for any , there is a data structure using space that answers episode matching queries for any of length in time. We complement this upper bound with an almost matching lower bound, showing that any data structure that answers episode matching queries for patterns of length in time , must use space, unless the Strong -Set Disjointness Conjecture is false. Finally, for the special case of , we present a faster construction of the data structure using fast min-plus multiplication of bounded integer matrices.

Paper Structure

This paper contains 11 sections, 7 theorems, 8 equations, 1 figure.

Key Result

Theorem 1

For any $\epsilon>0$, Episode Matching on binary strings of lengths $n$ and $m = n^{\alpha}$ (for any fixed $\alpha\le 1$) cannot be solved in $O((mn)^{1-\epsilon})$ time, unless SETH is false.

Figures (1)

  • Figure 1: The alignment of $P$ and $S$ as described in the proof of Claim \ref{['claim_short']}.

Theorems & Definitions (23)

  • Theorem 1
  • Theorem 2
  • Theorem 3
  • Theorem 4
  • Conjecture 1: The Strong Exponential Time Hypothesis
  • Definition 1: Orthogonal Vectors Problem (OV)
  • Conjecture 2: Orthogonal Vectors Hypothesis (OVH)
  • Conjecture 3: Unbalanced Orthogonal Vectors Hypothesis (UOVH)
  • Definition 2: $k$-Set Disjointness Problem
  • Conjecture 4: Strong $k$-Set Disjointness Conjecture
  • ...and 13 more