This document discusses encoding data structures to answer range maximum queries (RMQs) in an optimal way. It describes how the shape of the Cartesian tree of an array A can be encoded in 2n bits to answer RMQ queries, returning the index of the maximum element rather than its value. It also discusses encodings for other problems like nearest larger values, range selection, and others. Many of these encodings use asymptotically optimal space of roughly n log k bits for an input of size n with parameter k.
Related topics: