Range Minimum Queries

Table of Contents 1 Naive 1.1 Compute on-the-fly 1.2 Precompute everything 2 Space lower bounds 3 Sparse Table: \(O(1)\) queries, \(O(n \log_2 n)\) words 4 Segment Tree: \(O(\log n)\) queries, \(O(n)\) words 5 Blocks: \(O(s)\) queries, \(O(n/s \log n)\) words 6 Cartesian Trees: \(O(1)\) queries, \(O(n)\) words 7 Recursive Cartesian Trees: \(O(1)\) queries, \(2n+o(n)\) bits 8 Blackboard \[…