While operations \emph{rank} and \emph{select} on static bitvectors can be supported in constant time, lower bounds show that supporting updates raises the cost per operation to $\Theta(\log n/ \log\log n)$. This is a shame in scenarios where updates are possible but uncommon. We develop a representation of bitvectors that, if there are $q = \Omega(\log^2 n)$ queries per update, supports all the operations in $O(\log(n/q))$ amortized time. Our experimental results support the theoretical findings, displaying speedups of orders of magnitude compared to standard dynamic implementations.
翻译:尽管静态位向量上的 \emph{rank} 和 \emph{select} 操作可以在常数时间内完成,但下界表明支持更新操作会将每次操作的成本提升至 $\Theta(\log n/ \log\log n)$。这在更新可能发生但不频繁的场景中令人遗憾。我们提出了一种位向量的表示方法,若每次更新对应 $q = \Omega(\log^2 n)$ 次查询,则能以 $O(\log(n/q))$ 的摊还时间支持所有操作。我们的实验结果支持理论发现,与标准动态实现相比,显示出数量级的加速效果。