Article ID Journal Published Year Pages File Type
435227 Theoretical Computer Science 2011 6 Pages PDF
Abstract

Let A be a static array storing n elements from a totally ordered set. We present a data structure of optimal size at most bits that allows us to answer the following queries on A in constant time, without accessing A: (1) previous smaller value queries, where given an index i, we wish to find the first index to the left of i where A is strictly smaller than at i, and (2) next smaller value queries, which search to the right of i. As an additional bonus, our data structure also allows one to answer a third kind of query: given indices i

Related Topics
Physical Sciences and Engineering Computer Science Computational Theory and Mathematics