MFCS Conference 2013 Conference Paper
Linear-Space Data Structures for Range Frequency Queries on Arrays and Trees
- Stephane Durocher
- Rahul Shah 0001
- Matthew Skala
- Sharma V. Thankachan
Abstract 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, or α -minority 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 Chan et al. (SWAT 2012), where w ∈ Ω(log n ) is the word size in bits. We describe a data structure that supports range 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 Krizanc et al. (ISAAC 2003). Finally, we describe a data structure that supports range α -minority queries on trees in O ( α − 1 loglog n ) time, where α ∈ [0, 1] is specified at query time.