Abstract
We consider the problem of encoding range minimum queries (RMQs): given an array A[1..n] of distinct totally ordered values, to pre-process A and create a data structure that can answer the query RMQ(i,j), which returns the index containing the smallest element in A[i..j], without access to the array A at query time. We give a data structure whose space usage is 2n+o(n) bits, which is asymptotically optimal for worst-case data, and answers RMQs in O(1) worst-case time. This matches the previous result of Fischer and Heun, but is obtained in a more natural way. Furthermore, our result can encode the RMQs of a random array A in 1.919n+o(n) bits in expectation, which is not known to hold for Fischer and Heun's result. We then generalize our result to the encoding range top-2 query (RT2Q) problem, which is like the encoding RMQ problem except that the query RT2Q(i,j) returns the indices of both the smallest and second smallest elements of A[i..j]. We introduce a data structure using 3.272n+o(n) bits that answers RT2Qs in constant time, and also give lower bounds on the effective entropy of the RT2Q problem.
Highlights
Given an array A[1..n] of elements from a totally ordered set, the range minimum query (RMQ) problem is to pre-process A and create a data structure so that the query range minimum queries (RMQs)(i, j), which takes two indices 1 ≤ i ≤ j ≤ n and rsta.royalsocietypublishing.org Phil
We consider the problem of encoding range minimum queries (RMQs): given an array A[1..n] of distinct totally ordered values, to pre-process A and create a data structure that can answer the query RMQ(i, j), which returns the index containing the smallest element in A[i..j], without access to the array A at query time
We generalize our result to the encoding range top-2 query (RT2Q) problem, which is like the encoding RMQ problem except that the query RT2Q(i, j) returns the indices of both the smallest and second smallest elements of A[i..j]
Summary
Given an array A[1..n] of elements from a totally ordered set, the range minimum query (RMQ) problem is to pre-process A and create a data structure so that the query RMQ(i, j), which takes two indices 1 ≤ i ≤ j ≤ n and. Farzan & Munro [3] showed that an n-node binary tree can be represented in 2n + o(n) bits, while supporting LCA queries in O(1) time.1 This does not solve the RMQ problem. We show that this effective entropy applies to the (apparently) easier problem of returning just the second minimum in an array interval, R2M(i, j) We complement this result by giving a data structure for encoding RT2Qs that takes 3.272n + o(n) bits and answers queries in O(1) time. This structure builds upon our new 2n + o(n)-bit RMQ encoding by adding further functionality to the binary tree representation of Farzan and Munro.
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have
More From: Philosophical Transactions of the Royal Society A: Mathematical, Physical and Engineering Sciences
Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.