Hi, I have been learning segment tree. I have come across several codes on the internet. I am confused when to use the struct based implementation given here. Or when to use only a recusrsive implementation without using structures as given here. When is it better to usewhich approach? Thanks!
Structures are used when you want to save more than one variable(or information) in a node of a segment tree. Whereas if it is a single variable, you can implement it just using a 1-D array.