(Worst-Case) Optimal Adaptive Dynamic Bitvectors
Gonzalo Navarro
TL;DR
This work tackles the challenge of supporting dynamic updates on bitvectors while keeping space near the static optimum of $n+o(n)$ bits. It introduces adaptive dynamic bitvectors built on weight-balanced B-trees that convert subtrees into static leaves (flattening) when query load warrants, and that split static leaves on updates (splitting) to preserve balance. The main result is a near-optimal amortized time bound $O\bigl(\frac{\log(n/q)}{\log\log n}\bigr)$ for all operations when queries are $q$ times more frequent than updates, and a matching worst-case lower bound in the cell-probe model. The approach yields a versatile framework with broad applicability to dynamic compact data structures, including arrays, wavelet trees, grids, graphs, and text collections, improving efficiency in scenarios with bursty updates or sparse modifications.
Abstract
While operations {\em rank} and {\em select} on static bitvectors can be supported in constant time, lower bounds show that supporting updates raises the cost per operation to $Θ(\log n/ \log\log n)$ on bitvectors holding $n$ bits. This is a shame in scenarios where updates are possible but uncommon. We develop a representation of bitvectors that we call adaptive dynamic bitvector, which uses the asymptotically optimal $n+o(n)$ bits of space and, if there are $q$ queries per update, supports all the operations in $O(\log(n/q)/\log\log n)$ amortized time. Further, we prove that this time is \new{worst-case} optimal in the cell probe model. We describe a large number of applications of our representation to other compact dynamic data structures.
