### Abstract

In nearest larger value (NLV) problems, we are given an array A[1..n] of distinct numbers, and need to preprocess A to answer queries of the following form: given any index i∈[1,n], return a "nearest" index j such that A[j]>A[i]. We consider the variant where the values in A are distinct, and we wish to return an index j such that A[j]>A[i] and |j-i| is minimized, the nondirectional NLV (NNLV) problem. We consider NNLV in the encoding model, where the array A is deleted after preprocessing.The NNLV encoding problem turns out to have an unexpectedly rich structure: the effective entropy (optimal space usage) of the problem depends crucially on details in the definition of the problem. Of particular interest is the tiebreaking rule: if there exist two nearest indices j1,j2 such that A[j1]>A[i] and A[j2]>A[i] and |j1-i|=|j2-i|, then which index should be returned? For the tiebreaking rule where the rightmost (i.e., largest) index is returned, we encode a path-compressed representation of the Cartesian tree that can answer all NNLV queries in 1.89997n+o(n) bits, and can answer queries in O(1) time. An alternative approach, based on forbidden patterns, achieves a very similar space bound for two tiebreaking rules (including the one where ties are broken to the right), and (for a more flexible tiebreaking rule) achieves 1.81211n+o(n) bits. Finally, we develop a fast method of counting distinguishable configurations for NNLV queries. Using this method, we prove a lower bound of 1.62309n-Θ(1) bits of space for NNLV encodings for the tiebreaking rule where the rightmost index is returned.

Original language | English (US) |
---|---|

Journal | Theoretical Computer Science |

DOIs | |

State | Accepted/In press - Jun 10 2016 |

### Fingerprint

### Keywords

- Data structures
- Encoding data structures
- Succinct data structures

### ASJC Scopus subject areas

- Theoretical Computer Science
- Computer Science(all)

### Cite this

*Theoretical Computer Science*. https://doi.org/10.1016/j.tcs.2017.02.017

**Encoding nearest larger values.** / Hoffmann, Michael; Iacono, John; Nicholson, Patrick K.; Raman, Rajeev.

Research output: Contribution to journal › Article

*Theoretical Computer Science*. https://doi.org/10.1016/j.tcs.2017.02.017

}

TY - JOUR

T1 - Encoding nearest larger values

AU - Hoffmann, Michael

AU - Iacono, John

AU - Nicholson, Patrick K.

AU - Raman, Rajeev

PY - 2016/6/10

Y1 - 2016/6/10

N2 - In nearest larger value (NLV) problems, we are given an array A[1..n] of distinct numbers, and need to preprocess A to answer queries of the following form: given any index i∈[1,n], return a "nearest" index j such that A[j]>A[i]. We consider the variant where the values in A are distinct, and we wish to return an index j such that A[j]>A[i] and |j-i| is minimized, the nondirectional NLV (NNLV) problem. We consider NNLV in the encoding model, where the array A is deleted after preprocessing.The NNLV encoding problem turns out to have an unexpectedly rich structure: the effective entropy (optimal space usage) of the problem depends crucially on details in the definition of the problem. Of particular interest is the tiebreaking rule: if there exist two nearest indices j1,j2 such that A[j1]>A[i] and A[j2]>A[i] and |j1-i|=|j2-i|, then which index should be returned? For the tiebreaking rule where the rightmost (i.e., largest) index is returned, we encode a path-compressed representation of the Cartesian tree that can answer all NNLV queries in 1.89997n+o(n) bits, and can answer queries in O(1) time. An alternative approach, based on forbidden patterns, achieves a very similar space bound for two tiebreaking rules (including the one where ties are broken to the right), and (for a more flexible tiebreaking rule) achieves 1.81211n+o(n) bits. Finally, we develop a fast method of counting distinguishable configurations for NNLV queries. Using this method, we prove a lower bound of 1.62309n-Θ(1) bits of space for NNLV encodings for the tiebreaking rule where the rightmost index is returned.

AB - In nearest larger value (NLV) problems, we are given an array A[1..n] of distinct numbers, and need to preprocess A to answer queries of the following form: given any index i∈[1,n], return a "nearest" index j such that A[j]>A[i]. We consider the variant where the values in A are distinct, and we wish to return an index j such that A[j]>A[i] and |j-i| is minimized, the nondirectional NLV (NNLV) problem. We consider NNLV in the encoding model, where the array A is deleted after preprocessing.The NNLV encoding problem turns out to have an unexpectedly rich structure: the effective entropy (optimal space usage) of the problem depends crucially on details in the definition of the problem. Of particular interest is the tiebreaking rule: if there exist two nearest indices j1,j2 such that A[j1]>A[i] and A[j2]>A[i] and |j1-i|=|j2-i|, then which index should be returned? For the tiebreaking rule where the rightmost (i.e., largest) index is returned, we encode a path-compressed representation of the Cartesian tree that can answer all NNLV queries in 1.89997n+o(n) bits, and can answer queries in O(1) time. An alternative approach, based on forbidden patterns, achieves a very similar space bound for two tiebreaking rules (including the one where ties are broken to the right), and (for a more flexible tiebreaking rule) achieves 1.81211n+o(n) bits. Finally, we develop a fast method of counting distinguishable configurations for NNLV queries. Using this method, we prove a lower bound of 1.62309n-Θ(1) bits of space for NNLV encodings for the tiebreaking rule where the rightmost index is returned.

KW - Data structures

KW - Encoding data structures

KW - Succinct data structures

UR - http://www.scopus.com/inward/record.url?scp=85015756416&partnerID=8YFLogxK

UR - http://www.scopus.com/inward/citedby.url?scp=85015756416&partnerID=8YFLogxK

U2 - 10.1016/j.tcs.2017.02.017

DO - 10.1016/j.tcs.2017.02.017

M3 - Article

JO - Theoretical Computer Science

JF - Theoretical Computer Science

SN - 0304-3975

ER -