English

Counting Colours in Compressed Strings

Data Structures and Algorithms 2010-11-16 v1

Abstract

Suppose we are asked to preprocess a string s[1..n]s [1..n] such that later, given a substring's endpoints, we can quickly count how many distinct characters it contains. In this paper we give a data structure for this problem that takes nH0(s)+\Ohn+\ohnH0(s)n H_0 (s) + \Oh{n} + \oh{n H_0 (s)} bits, where H0(s)H_0 (s) is the 0th-order empirical entropy of ss, and answers queries in \Ohlog1+ϵn\Oh{\log^{1 + \epsilon} n} time for any constant ϵ>0\epsilon > 0. We also show how our data structure can be made partially dynamic.

Keywords

Cite

@article{arxiv.1011.3480,
  title  = {Counting Colours in Compressed Strings},
  author = {Travis Gagie and Juha Kärkkäinen},
  journal= {arXiv preprint arXiv:1011.3480},
  year   = {2010}
}
R2 v1 2026-06-21T16:44:06.248Z