线段树节点结构不清晰

segment tree node structure not clear

我正在尝试构建一个线段树,但节点结构不清楚,谁能解释一下我找到的代码

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);};

您指定的部分是带有初始化列表的构造函数。为了使它更加混乱,它对参数使用与对成员变量相同的名称。也许不那么令人困惑,可以编写完全相同的代码:

node(int cnt, node *lhs, node *rhs)
    : count(cnt), left(lhs), right(rhs)
{}

或者:

node(int cnt, node *lhs, node *rhs)
{
    count = cnt;
    left = lhs;
    right = rhs;
}