For an array A of n objects from a totally ordered universe, a range minimum query rmq A (i, j) asks for the position of the minimum element in the sub-array A[i, j]. This fun-damental algorithmic problem has applications in string processing, text indexing, text com-pression, document retrieval, and graph-or tree-navigation, just to name a few. We focus on the setting where the array A is static
... [Show full abstract] and known in advance, and can hence be preprocessed into a scheme in order to answer future queries faster. It has been known for a long time (Gabow et al., STOC 1984) that there is a linear-time preprocessing scheme for O(1)-RMQs by reducing this problem to the computation of lowest common ancestors in trees (Harel and Tarjan, SICOMP 13(2): 1984). The drawback of this and most later schemes is their huge space consumption of O(n log n) bits, which is not optimal. We make the assumption that the input array A cannot be used at query time. This is important for at least two reasons: (1) In some applications such as document retrieval sys-tems (Muthukrishnan, SODA 2002; Sadakane, ISAAC 2002), only the position of the minimum matters, and not the value of that minimum. Hence it would be a waste of space to keep A in memory just for answering RMQs. (2) In applications where the access to A takes ω(1) time, schemes that need to access A for answering RMQs can never have constant query time. An important example of this comes from string processing, where RMQ is often used in conjunc-tion with the array of longest common prefixes of lexicographically consecutive suffixes, which has non-constant access time if it is stored in a space-efficient form (Sadakane, SODA 2002). Under the assumption that A cannot be used at query time, a natural lower bound of 2n − Θ(log n) bits for RMQ-schemes exists. The only previous scheme in this setting is due to Sadakane (ISSAC 2002), and needs 4n+o(n) bits of space. Apart from not being asymptotically optimal, it has the further drawback that it needs O(n log n) bits of intermediate space at preprocessing time if it is to be constructed in linear time. This peak space consumption often limits the practicability of a data structure. We settle the above mentioned problems of Sadakane's solution by giving the first truly succinct preprocessing scheme for O(1)-RMQs. Its final space consumption is 2n + o(n) bits, thus being asymptotically optimal. We also give a simple linear-time construction algorithm for this scheme that needs only n + o(n) bits of space in addition to the 2n + o(n) bits needed for the final data structure, thus lowering the peak space consumption from O(n log n) to O(n) bits. An interesting side effect of our work is that we also lower the space-consumption for O(1)-computation of lowest common ancestors in BPS-or DFUDS-encoded ordered trees (Sadakane, SODA 2002; Jansson et al., SODA 2007) from O(n log 2 log n log n) to O(n log log n log n) bits.