Please help me understand this statement in lazy propagation for segment trees.
I would have expected incrementing by merely Lazy[treeIndex]:
tree[treeIndex] += Lazy[treeIndex]
Context:
void RangeUpdate(int node, int st, int end, int l, int r, long long val)
{
if(Lazy[node] != 0) // if node is lazy then update it
{
tree[node] += (end-st+1)*Lazy[node];
Full code as found here—
Sourced from: https://medium.com/nybles/understanding-range-queries-and-updates-segment-tree-lazy-propagation-and-mos-algorithm-d2cd2f6586d8