an:06559783
Zbl 1411.68034
Durocher, Stephane; Shah, Rahul; Skala, Matthew; Thankachan, Sharma V.
Linear-space data structures for range frequency queries on arrays and trees
EN
Algorithmica 74, No. 1, 344-366 (2016).
00352772
2016
j
68P05
data structures; range query; path query; linear space; frequency; color query
Summary: We present \(O(n)\)-space data structures to support various range frequency queries on a given array \(A[0:n-1]\) or tree \(T\) with \(n\) nodes. Given a query consisting of an arbitrary pair of pre-order rank indices \((i,j)\), our data structures return a least frequent element, mode, \(\alpha\)-minority, or top-\(k\) colors (values) of the multiset of elements in the unique path with endpoints at indices \(i\) and \(j\) in \(A\) or \(T\). We describe a data structure that supports range least frequent element queries on arrays in \(O(\sqrt{n/w})\) time, improving the \(\Theta(\sqrt n)\) worst-case time required by the data structure of \textit{T. M. Chan} et al. [Lect. Notes Comput. Sci. 7357, 295--306 (2012; Zbl 1318.68068)], where \(w\in\Omega(\log n)\) is the word size in bits. We describe a data structure that supports path mode queries on trees in \(O(\log\log n\sqrt{n/w})\) time, improving the \(\Theta(\sqrt n\log n)\) worst-case time required by the data structure of \textit{D. Krizanc} et al. [Lect. Notes Comput. Sci. 2906, 517--526 (2003; Zbl 1205.68130)]. We describe the first data structures to support path least frequent element queries, path \(\alpha\)-minority queries, and path top-\(k\) color queries on trees in \(O(\log\log n\sqrt{n/w})\), \(O(\alpha^{-1}\log\log n)\), and \(O(k)\) time, respectively, where \(\alpha\in[0,1]\) and \(k\in\{1,\dots,n\}\) are specified at query time.
Zbl 1318.68068; Zbl 1205.68130