No. of nodes in a recursive segment tree of an array of size $n$ is $2n1$. But still choosing $2n 1$ as the size of segment tree gives a segmentation fault, and I have seen it in many places that it's recommended to use size of segment tree as $4n$. But why? Can someone clarify on this? asked 22 Jun '18, 15:31

@pshishod2645 , you can have a look to this link for a formal proof https://stackoverflow.com/questions/28470692/howisthememoryofthearrayofsegmenttree22ceillogn1 answered 22 Jun '18, 15:41
Thanks @aman_robotics
(22 Jun '18, 15:51)

@pshishod2645 , If you like to build memory efficient program then you can build segment tree in iterative format. Then it will never use more than 2N memory and if you also want to have lazy propagation then it will require a total of 2N + N = 3*N memory ( extra N for lazy array ). :) answered 22 Jun '18, 16:16
Iterative version of segment tree is clear to me, I was just having a doubt about it's recursive version.
(22 Jun '18, 16:30)
