We present a new data structure for maintaining dynamic permutations, which we call a $\textit{forest of splay trees (FST)}$. The FST allows one to efficiently maintain the cycle structure of a permutation $\pi$ when the allowed updates are transpositions. The structure stores one conceptual splay tree for each cycle of $\pi$, using the position within the cycle as the key. Updating $\pi$ to $\tau\cdot\pi$, for a transposition $\tau$, takes $\mathcal{O}(\log n)$ amortized time, where $n$ is the size of $\pi$. The FST computes any $\pi(i)$, $\pi^{-1}(i)$, $\pi^k(i)$ and $\pi^{-k}(i)$, in $\mathcal{O}(\log n)$ amortized time. Further, it supports cycle-specific queries such as determining whether two elements belong to the same cycle, flip a segment of a cycle, and others, again within $\mathcal{O}(\log n)$ amortized time.
翻译:我们提出一种新的动态置换数据结构,称为**伸展树森林**(FST)。FST允许在允许的更新为对换的情况下高效维护置换$\pi$的循环结构。该结构为$\pi$的每个循环存储一棵概念上的伸展树,以循环内的位置作为键值。将$\pi$更新为$\tau\cdot\pi$(其中$\tau$为对换)所需摊还时间为$\mathcal{O}(\log n)$,$n$为$\pi$的规模。FST可在$\mathcal{O}(\log n)$摊还时间内计算任意$\pi(i)$、$\pi^{-1}(i)$、$\pi^k(i)$和$\pi^{-k}(i)$。此外,它还支持循环特定查询,例如判断两个元素是否属于同一循环、翻转循环的某一段等,同样在$\mathcal{O}(\log n)$摊还时间内完成。