English

Ranking and Unranking k-subsequence universal words

Data Structures and Algorithms 2023-04-11 v1 Combinatorics

Abstract

A subsequence of a word ww is a word uu such that u=w[i1]w[i2],w[iu]u = w[i_1] w[i_2] , \dots w[i_{|u|}], for some set of indices 1i1<i2<<ikw1 \leq i_1 < i_2 < \dots < i_k \leq |w|. A word ww is kk-subsequence universal over an alphabet Σ\Sigma if every word in Σk\Sigma^k appears in ww as a subsequence. In this paper, we provide new algorithms for kk-subsequence universal words of fixed length nn over the alphabet Σ={1,2,,σ}\Sigma = \{1,2,\dots, \sigma\}. Letting U(n,k,σ)\mathcal{U}(n,k,\sigma) denote the set of nn-length kk-subsequence universal words over Σ\Sigma, we provide: * an O(nkσ)O(n k \sigma) time algorithm for counting the size of U(n,k,σ)\mathcal{U}(n,k,\sigma); * an O(nkσ)O(n k \sigma) time algorithm for ranking words in the set U(n,k,σ)\mathcal{U}(n,k,\sigma); * an O(nkσ)O(n k \sigma) time algorithm for unranking words from the set U(n,k,σ)\mathcal{U}(n,k,\sigma); * an algorithm for enumerating the set U(n,k,σ)\mathcal{U}(n,k,\sigma) with O(nσ)O(n \sigma) delay after O(nkσ)O(n k \sigma) preprocessing.

Keywords

Cite

@article{arxiv.2304.04583,
  title  = {Ranking and Unranking k-subsequence universal words},
  author = {Duncan Adamson},
  journal= {arXiv preprint arXiv:2304.04583},
  year   = {2023}
}
R2 v1 2026-06-28T09:57:22.064Z