Hope you and your family is safe and sound.
Doubt:-
As shown in the video that we are representing the segment tree as an array. My doubt is why the array size is 4N+1 . I see that even 2N + 1 would suffice.
Hope you and your family is safe and sound.
Doubt:-
As shown in the video that we are representing the segment tree as an array. My doubt is why the array size is 4N+1 . I see that even 2N + 1 would suffice.
Hi Aditya, I hope your are doing good as well.
Please see the structure of segment tree subheading in this tutorial https://cp-algorithms.com/data_structures/segment_tree.html
If you read further there is a memory efficient implementation as well.