I am trying to build a segment tree but the node structure is not clear can someone please explain the code i found
struct node{
int count;
node *left, *right;
node(int count, node *left, node *right):
count(count), left(left), right(right) {}//what this part is doing please explain and how it affects the complexity of the segment tree as compared to other initialization method
node* insert(int l, int r, int w);};
The part you indicated is a constructor with an initialization list. To make it more confusing it uses the same names for the parameters as it does for the member variables. Perhaps less confusing, the exact same code could be written:
node(int cnt, node *lhs, node *rhs)
: count(cnt), left(lhs), right(rhs)
{}
Or:
node(int cnt, node *lhs, node *rhs)
{
count = cnt;
left = lhs;
right = rhs;
}