I was recently up-solving AtCoder Beginner Contest 339 and came across a Persistent Segment Tree Problem G — Smaller Sum.
While implementing my own Persistent Segment Tree. I tried to make it as generic as possible.
Code:
Here are few things that I want your help and opinion on:
- Is their a more generic and efficient way to implement Persistent Segment Tree? and How to improve the above code?
- How can you identify if a problem uses Persistent Segment Tree?
- Is their a better way to implement custom allocator for Competitive Programming(or for C++/C projects)?
- How to implement Lazy Persistent Segment Tree?
- How to add documentation to Personal Library codes?