The motivation for binary indexed trees is similar to that of segment trees. However, note that segment trees are much more flexible than binary indexed trees, and usually its true that any pr...
I find this (https://www.dropbox.com/s/uwxn0fipojvbfex/segtree.pdf?dl=0) tutorial really intuitive for both Segment Tree and BIT and also the transition from Segment Tree to BIT.
Here are some MST (Minimum Spanning Tree) questions to practice implementing Prim's or Kruskal's algorithm
You can try these also CoalScam, MSTQueries, and DAVIDG-SPOJ (not sure about DAVIDG one! )
Can anyone provide some hints to this problem? Although N <= 10^18 but there is some pattern which I am not able to detect.
How to solve this probem? Can you give some hints. Probably it's a DP problem.