|
ADS
Algorithms and Data Structures
|
The ordered tree of any degree in \( 2 n \) bits by its balanced parentheses: a visit in depth writes an open parenthesis when it enters a node and a closed one when it leaves it, so that a node is the pair of its parentheses and its subtree is what they enclose (the code with which chapter 15, Compressed Data Structures, of Ferragina's book counts the trees of \( n \) nodes). More...
#include "ADS/Contract.h"#include "ADS/succinct/BalancedParentheses.h"#include "ADS/succinct/BitVector.h"#include <cstddef>#include <string_view>#include <utility>#include <vector>#include "ADS/succinct/impl/BPTree.tpp"Go to the source code of this file.
Classes | |
| class | ADS::BPTree |
| an ordered tree in \( 2 n \) bits by balanced parentheses, its nodes in preorder More... | |
Namespaces | |
| namespace | ADS |
The ordered tree of any degree in \( 2 n \) bits by its balanced parentheses: a visit in depth writes an open parenthesis when it enters a node and a closed one when it leaves it, so that a node is the pair of its parentheses and its subtree is what they enclose (the code with which chapter 15, Compressed Data Structures, of Ferragina's book counts the trees of \( n \) nodes).
The nodes are numbered in preorder, the node \( v \) being the \( ( v + 1 ) \)-th open parenthesis, at the place \( \mathrm{select}_1( v + 1 ) \), and with the matching of the parentheses [see BalancedParentheses.h]:
in the time of a search in the range min-max tree, \( O( \log ( n / 8192 ) ) \) plus the scan of a group and of a leaf, and in the time of a select and of a rank for leftmostChild(), depth() and isLeaf(). Against LOUDS [see LoudsTree.h], the parentheses also give the size of a subtree, the depth and the ancestors, and number the nodes of a subtree consecutively (from \( v \) to \( v + \mathrm{subtreeSize}( v ) - 1 \)), at the price of the searches; DFUDS of Benoit, Demaine, Munro, Raman, Raman and Rao, the degrees in unary in preorder, also gives the \( i \)-th child in \( O( 1 ) \) time with the same matching, which the same chapter does not treat.
The contracts [see Contract.h]: the lists of the children describe a tree rooted at 0, the parentheses are balanced and enclose one tree, and the nodes are in \( [ 0 , n ) \). The functions are defined in BPTree.tpp.