Class BalancedParentheses

Class Documentation

class BalancedParentheses

a static sequence of balanced parentheses with a range min-max tree

Public Functions

BalancedParentheses(void)
explicit BalancedParentheses(BitVector b)

the parentheses b, 1 for ‘(’ and 0 for ‘)’

Pre:

b is balanced (an audit)

std::size_t size(void) const
bool operator[](std::size_t i) const

whether the place i has a ‘(’

Pre:

i < size()

std::int64_t excess(std::size_t i) const

E( i ), the ‘(’ minus the ‘)’ in [ 0 , i ].

Pre:

i < size()

std::size_t findClose(std::size_t i) const

the ‘)’ of the ‘(’ at i

Pre:

the place i has a ‘(’

Post:

the place after i with the excess E( i ) - 1, the first one

std::size_t findOpen(std::size_t j) const

the ‘(’ of the ‘)’ at j

Pre:

the place j has a ‘)’

Post:

findClose() of it is j

std::size_t enclose(std::size_t i) const

the ‘(’ of the pair that encloses the ‘(’ at i, nil if none

Pre:

the place i has a ‘(’

const CompactRankSelect &bits(void) const

the parentheses with their rank and select

std::size_t treeBits(void) const

the bits of the range min-max tree

Public Static Attributes

static constexpr std::size_t nil = std::size_t(-1)

no place