You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem:
The article states that Maximum number of nodes a segment tree would have is 4N, but if you look at the equation, maximum number of nodes a segment tree would have is 2N - 1.
The text was updated successfully, but these errors were encountered:
Say your array has a size of N = 2^k+1 for which you want to find the sum of elements [l, r] where 0<=l,r<=N-1
Now in the segment tree, the number fo leaf nodes has to be 2^(k+1) (rounded up by two factor) and
since the leaf nodes are 2^(k+1), the total number of nodes would be 2^(k+2) ~ 4N
Article: Segment Tree
Problem:
The article states that Maximum number of nodes a segment tree would have is 4N, but if you look at the equation, maximum number of nodes a segment tree would have is 2N - 1.
The text was updated successfully, but these errors were encountered: