TheAlgorithms/C++ 1.0.0
All the algorithms implemented in C++
|
Segment Tree, to store heavy chains. More...
Private Member Functions | |
X | combine (X lhs, X rhs) |
Function that specifies the type of operation involved when segments are combined. | |
SG (int size) | |
Class parameterized constructor. Resizes the and initilizes the data members. | |
void | update (int p, X v) |
Update the value at a node. | |
X | query (int l, int r) |
Make a range query from node label l to node label r. | |
void | set_sret_init (X new_sret_init) |
Set the initialization for the query data type, based on requirement. | |
Private Attributes | |
std::vector< X > | s_tree |
Everything here is private, and can only be accessed through the methods, in the derived class (HLD) | |
int | s_size |
number of leaves in the segment tree | |
X | sret_init = 0 |
inital query return value | |
Friends | |
template<typename T > | |
class | HLD |
Segment Tree, to store heavy chains.
the | data type of the values stored in the tree nodes |
Definition at line 254 of file heavy_light_decomposition.cpp.
|
inlineexplicitprivate |
Class parameterized constructor. Resizes the and initilizes the data members.
nodes | the total number of nodes in the tree |
Definition at line 282 of file heavy_light_decomposition.cpp.
|
inlineprivate |
Function that specifies the type of operation involved when segments are combined.
lhs | the left segment |
rhs | the right segment |
Definition at line 274 of file heavy_light_decomposition.cpp.
|
inlineprivate |
Make a range query from node label l to node label r.
l | node label where the path starts |
r | node label where the path ends |
Definition at line 305 of file heavy_light_decomposition.cpp.
|
inlineprivate |
Set the initialization for the query data type, based on requirement.
Change the sret_init, based on requirement:
new_sret_init | the new init |
Definition at line 329 of file heavy_light_decomposition.cpp.
|
inlineprivate |
Update the value at a node.
p | the node to be udpated |
v | the update value |
Definition at line 293 of file heavy_light_decomposition.cpp.
Definition at line 265 of file heavy_light_decomposition.cpp.
|
private |
number of leaves in the segment tree
Definition at line 263 of file heavy_light_decomposition.cpp.
|
private |
Everything here is private, and can only be accessed through the methods, in the derived class (HLD)
the segment tree, stored as a vector
Definition at line 262 of file heavy_light_decomposition.cpp.
|
private |
inital query return value
Definition at line 264 of file heavy_light_decomposition.cpp.