We present linear-space data structures for several frequency queries on trees, namely: path mode, path least frequent element, and path $α$-minority queries. We present the first linear-space data structures, requiring $O(n \sqrt{nw})$ preprocessing time, that can answer path mode and path least frequent element queries in $O(\sqrt{n/w})$ time. This improves upon the best previously known bound of $O(\log\log n \sqrt{n/w})$ achieved by Durocher et al. in 2016. For the path $α$-minority problem, where $α$ is specified at query time, we reduce the query time of the linear-space data structure of Durocher et al. from $O(α^{-1}\log\log n)$ down to $O(α^{-1})$ by employing a simple randomized algorithm with a success probability $\geq 1/2$. We also present the first linear-space data structure supporting "Path Maximum $g$-value Color" queries in $O(\sqrt{n/w})$ time, requiring $O(n \sqrt{nw})$ preprocessing time. This general framework encapsulates both path mode and path least frequent element queries. For our data structures, we consider the word-RAM model with $w\in Ω(\log n)$, where $w$ is the word size in bits.
翻译:我们提出了面向树上若干频率查询的线性空间数据结构,具体包括:路径众数、路径最小频率元素以及路径$α$-少数元素查询。本文首次给出了需要$O(n \sqrt{nw})$预处理时间的线性空间数据结构,能在$O(\sqrt{n/w})$时间内回答路径众数和路径最小频率元素查询。这改进了Durocher等人于2016年取得的最优已知上界$O(\log\log n \sqrt{n/w})$。对于路径$α$-少数元素问题(其中$α$在查询时指定),我们通过采用成功概率$\geq 1/2$的简单随机算法,将Durocher等人线性空间数据结构的查询时间从$O(α^{-1}\log\log n)$降至$O(α^{-1})$。我们还首次提出支持$O(\sqrt{n/w})$时间“路径最大$g$值颜色”查询的线性空间数据结构,其预处理时间为$O(n \sqrt{nw})$。该通用框架同时囊括了路径众数和路径最小频率元素查询。对于所提数据结构,我们采用字RAM模型,其中$w\in Ω(\log n)$,$w$表示以比特为单位的字长。