Algorithms_in_C++ 1.0.0
Set of 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 |
|
inlineexplicitprivate |
Class parameterized constructor. Resizes the and initilizes the data members.
nodes | the total number of nodes in the tree |
|
inlineprivate |
Function that specifies the type of operation involved when segments are combined.
lhs | the left segment |
rhs | the right segment |
|
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 |
|
inlineprivate |
|
inlineprivate |
|
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