Abstract

We consider the problem of succinctly representing a given vertex-weighted tree of n vertices, whose vertices are labeled by integer weights from { 1 , 2 , … , σ } and supporting the following path queries efficiently: • Path median query : Given two vertices i , j , return the median weight on the path from i to j . • Path selection query : Given two vertices i , j and a positive integer k , return the k th smallest weight on the path from i to j . • Path counting/reporting query : Given two vertices i , j and a range [ a , b ] , count/report the vertices on the path from i to j whose weights are in this range. The previous best data structure supporting these queries takes O ( n log n ) bits space and can perform path median/selection/counting in O ( log σ ) time and path reporting in O ( log σ + occ log σ ) time, where occ represents the number of outputs [M. He, J.I. Munro, G. Zhou, Path queries in weighted trees, in: International Symposium on Algorithms and Computation, 2011, pp. 140–149]. We present a succinct data structure taking n log σ + 6 n + o ( n log σ ) bits space that can perform the above mentioned queries in O ( log σ log n ) and O ( log σ log n + occ log σ ) time respectively.

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.