Motivated by the problem of counting unique visitors to a website, we consider how to preprocess a string s [1..n] such that later, given a substring's endpoints, we can quickly count how many distinct characters that substring contains. The smallest reasonably fast previous data structure for this problem takes n log σ + O(n log log n) bits and answers queries in O(log n) time. We give a data structure for this problem that takes nH 0(s)+O(n)+o(nH0(s)) bits, where H 0 (s) is the 0th-order empirical entropy of s, and answers queries in O (log ℓ) time, where ℓ is the length of the query substring. As far as we know, this is the first data structure, where the query time depends only on ℓ and not on n. We also show how our data structure can be made partially dynamic. © 2011 Springer-Verlag.
CITATION STYLE
Gagie, T., & Kärkkäinen, J. (2011). Counting colours in compressed strings. In Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics) (Vol. 6661 LNCS, pp. 197–207). https://doi.org/10.1007/978-3-642-21458-5_18
Mendeley helps you to discover research relevant for your work.