understanding segment tree

Hello guys, I need a little help implementing and understanding segment tree data structure. I have read many online tutorials and I understand the concept pretty well. But when comes to implementing the code, my knowledge falls out of the sky. I am not getting desired output in any of my attempts. What should I do next?

link this tutorial contains implementation.

1 Like

Refer this

This link contains list of problems along with nice explanation of segment tree. This should clear all your problems :slight_smile:

Try to share the code via ideone link . Any one of us could help you debug it