Recently in the brush data structure
The problem of data structure is simpler than graph theory, from unfamiliar to ... Konjac Konjac.
Tree array & Segment Tree Basics
Tree Array + differential + discretization = "can be used for reverse order
The tree array + difference can make an interval modification;
Of course, you can use a tree-like array, the basic (do not know is not all) can use line tree.
The operation of the segment tree is much more complex, the sub-function has a build (), query (), update (), Pushdown () (lazy tag down a bit difficult)
Line Tree Exercises: Hotel a bit immortal ...
Second, LCA
Before will only use St algorithm, later, I chose Tarjan (this cow person!!) ), because it really works;
Some things to note is the array size, build, query tree, query the number of notes, m=n* (n-1)/2. (such as encountered a problem only 10000kb got more than 10 times to try out the size of the array open.) Of course, this disgusting problem is rare)
The rest is to be careful, careful, and careful. (data structure is not much disgusting is because it is generally easy to find errors, variable names into ...). )
Third, RMQ
A wave of data structures