Range min–max tree over a bitvector (LSB-first) tailored for balanced-parentheses (BP).
More...
|
|
| RmMTree ()=default |
| | Construct empty structure.
|
| |
| | RmMTree (std::span< const std::uint64_t > words, size_t bit_count, const size_t &leaf_block_bits=0, const float &max_overhead=-1.0) |
| | Build from a non-owning view of 64-bit words (LSB-first).
|
| |
|
size_t | size_impl () const |
| |
| size_t | rank1_impl (const size_t &end_position) const |
| | Number of ones in prefix [0, end_position).
|
| |
| size_t | rank0_impl (const size_t &end_position) const |
| | Number of zeros in prefix [0, end_position).
|
| |
| size_t | select1_impl (size_t target_one_rank) const |
| | 1-based select of the target_one_rank-th one.
|
| |
| size_t | select0_impl (size_t target_zero_rank) const |
| | 1-based select of the target_zero_rank-th zero.
|
| |
| size_t | rank10_impl (const size_t &end_position) const |
| | Rank of the pattern "10" (starts) within [0, end_position).
|
| |
| size_t | select10_impl (size_t target_pattern_rank) const |
| | 1-based select of the target_pattern_rank-th "10" start.
|
| |
|
int | excess_impl (const size_t &end_position) const |
| | Prefix excess on [0, end_position): +1 for '1', −1 for '0'.
|
| |
| size_t | fwdsearch_impl (const size_t &start_position, const int &delta) const |
| | Forward search: first position p ≥ start_position where excess_impl(p) = excess_impl(start_position) + delta.
|
| |
| size_t | bwdsearch_impl (const size_t &start_position, const int &delta) const |
| | Backward search: last position p ≤ start_position where excess_impl(p) = excess_impl(start_position) + delta.
|
| |
| size_t | range_min_query_pos_impl (const size_t &range_begin, const size_t &range_end) const |
| | Position of the first minimum of excess on [range_begin, range_end] (inclusive).
|
| |
| int | range_min_query_val_impl (const size_t &range_begin, const size_t &range_end) const |
| | Value of the minimum prefix excess on [range_begin, range_end] relative to range_begin.
|
| |
| size_t | range_max_query_pos_impl (const size_t &range_begin, const size_t &range_end) const |
| | Position of the first maximum of excess on [range_begin, range_end] (inclusive).
|
| |
|
int | range_max_query_val_impl (const size_t &range_begin, const size_t &range_end) const |
| | Value of the maximum prefix excess on [range_begin, range_end] relative to range_begin.
|
| |
|
size_t | mincount_impl (const size_t &range_begin, const size_t &range_end) const |
| | How many times the minimum prefix excess occurs on [range_begin, range_end].
|
| |
| size_t | minselect_impl (const size_t &range_begin, const size_t &range_end, size_t target_min_rank) const |
| | Position of the target_min_rank-th (1-based) occurrence of the minimum on [range_begin, range_end].
|
| |
| size_t | close_impl (const size_t &open_position) const |
| | close_impl(open_position): matching ')' for '(' at open_position.
|
| |
| size_t | open_impl (const size_t &close_position) const |
| | open_impl(close_position): matching '(' for ')' at close_position.
|
| |
| size_t | enclose_impl (const size_t &position) const |
| | enclose_impl(position): opening '(' that strictly encloses position.
|
| |
|
int | bit (const size_t &position) const noexcept |
| | Read bit at position position (LSB-first across words).
|
| |
|
std::size_t | size () const |
| | Number of bits in the represented sequence.
|
| |
|
std::size_t | rank1 (std::size_t end_position) const |
| | Count 1 bits in the prefix [0, end_position).
|
| |
|
std::size_t | rank0 (std::size_t end_position) const |
| | Count 0 bits in the prefix [0, end_position).
|
| |
| std::size_t | select1 (std::size_t rank) const |
| | Return the zero-based position of the rank-th 1 bit.
|
| |
| std::size_t | select0 (std::size_t rank) const |
| | Return the zero-based position of the rank-th 0 bit.
|
| |
| std::size_t | rank10 (std::size_t end_position) const |
| | Count "10" bit patterns fully contained in [0, end_position).
|
| |
| std::size_t | select10 (std::size_t rank) const |
| | Return the zero-based start position of the rank-th "10" pattern.
|
| |
|
int | excess (std::size_t end_position) const |
| | Prefix excess on [0, end_position): +1 for 1 bits, -1 for 0 bits.
|
| |
| std::size_t | fwdsearch (std::size_t start_position, int delta) const |
| | Forward excess search from a prefix boundary.
|
| |
| std::size_t | bwdsearch (std::size_t start_position, int delta) const |
| | Backward excess search from a prefix boundary.
|
| |
| std::size_t | range_min_query_pos (std::size_t range_begin, std::size_t range_end) const |
| | Position of the first minimum relative excess in [range_begin, range_end].
|
| |
| int | range_min_query_val (std::size_t range_begin, std::size_t range_end) const |
| | Minimum relative excess value over [range_begin, range_end].
|
| |
| std::size_t | range_max_query_pos (std::size_t range_begin, std::size_t range_end) const |
| | Position of the first maximum relative excess in [range_begin, range_end].
|
| |
| int | range_max_query_val (std::size_t range_begin, std::size_t range_end) const |
| | Maximum relative excess value over [range_begin, range_end].
|
| |
|
std::size_t | mincount (std::size_t range_begin, std::size_t range_end) const |
| | Count positions attaining the minimum relative excess in [range_begin, range_end].
|
| |
| std::size_t | minselect (std::size_t range_begin, std::size_t range_end, std::size_t rank) const |
| | Select a position attaining the minimum relative excess in [range_begin, range_end].
|
| |
| std::size_t | close (std::size_t open_position) const |
| | Matching closing parenthesis for the parenthesis at open_position.
|
| |
| std::size_t | open (std::size_t close_position) const |
| | Matching opening parenthesis for the parenthesis at close_position.
|
| |
| std::size_t | enclose (std::size_t open_position) const |
| | Closest opening parenthesis strictly enclosing position.
|
| |
|
int | bit (const size_t &position) const noexcept |
| | Read bit at position position (LSB-first across words).
|
| |
Range min–max tree over a bitvector (LSB-first) tailored for balanced-parentheses (BP).
Implements the classic rmq/rMq family and BP navigation in O(log n) using a perfectly balanced binary tree of blocks. Supported queries:
- rank1 / rank0
- select1 / select0
- rank10 / select10 (starts of "10")
- excess (prefix +1 for '1', −1 for '0')
- fwdsearch / bwdsearch (prefix–sum search)
- range_min_query_pos / range_min_query_val (first minimum within a range)
- range_max_query_pos / range_max_query_val (first maximum within a range)
- mincount / minselect (count/selection of minima)
- close / open / enclose (BP navigation)
The bitvector is LSB-first inside each 64-bit word. RmMTree stores a non-owning view of those words; callers must keep the backing storage alive and immutable for the lifetime of the tree.