English

Minimizers in Semi-Dynamic Strings

Data Structures and Algorithms 2025-02-25 v1

Abstract

Minimizers sampling is one of the most widely-used mechanisms for sampling strings. Let S=S[0]S[n1]S=S[0]\ldots S[n-1] be a string over an alphabet Σ\Sigma. In addition, let w2w\geq 2 and k1k\geq 1 be two integers and ρ=(Σk,)\rho=(\Sigma^k,\leq) be a total order on Σk\Sigma^k. The minimizer of window X=S[i..i+w+k2]X=S[i\mathinner{.\,.} i+w+k-2] is the smallest position in [i,i+w1][i,i+w-1] where the smallest length-kk substring of S[i..i+w+k2]S[i\mathinner{.\,.} i+w+k-2] based on ρ\rho starts. The set of minimizers for all i[0,nwk+1]i\in[0,n-w-k+1] is the set Mw,k,ρ(S)\mathcal{M}_{w,k,\rho}(S) of the minimizers of SS. The set Mw,k,ρ(S)\mathcal{M}_{w,k,\rho}(S) can be computed in O(n)\mathcal{O}(n) time. The folklore algorithm for this computation computes the minimizer of every window in O(1)\mathcal{O}(1) amortized time using O(w)\mathcal{O}(w) working space. It is thus natural to pose the following two questions: Question 1: Can we efficiently support other dynamic updates on the window? Question 2: Can we improve on the O(w)\mathcal{O}(w) working space? We answer both questions in the affirmative: 1. We term a string XX semi-dynamic when one is allowed to insert or delete a letter at any of its ends. We show a data structure that maintains a semi-dynamic string XX and supports minimizer queries in XX in O(1)\mathcal{O}(1) time with amortized O(1)\mathcal{O}(1) time per update operation. 2. We show that this data structure can be modified to occupy strongly sublinear space without increasing the asymptotic complexity of its operations. To the best of our knowledge, this yields the first algorithm for computing Mw,k,ρ(S)\mathcal{M}_{w,k,\rho}(S) in O(n)\mathcal{O}(n) time using O(w)\mathcal{O}(\sqrt{w}) working space. We complement our theoretical results with a concrete application and an experimental evaluation.

Keywords

Cite

@article{arxiv.2502.17199,
  title  = {Minimizers in Semi-Dynamic Strings},
  author = {Wiktor Zuba and Oded Lachish and Solon P. Pissis},
  journal= {arXiv preprint arXiv:2502.17199},
  year   = {2025}
}

Comments

16 pages

R2 v1 2026-06-28T21:55:35.107Z