hiho week 21 register





hiho! is a serial contests we developed to help programmers improve their skills following some architecture. Tree, as a data structure, has a significant feature that the problem on a tree usually can be divided in to several sub-problems on sub-trees which is very similar to what we have learned in "Dynamic Programming".

Sometimes, the intervals that segment-tree trys to deal with is in big range, and may not even intergers. This make the problem more complicated. But in this situation, the specific value is usually useless, the matter is the relation between the values, so we can remake these values to be what we want them to be - such as intergers started from 1, and this will help the calculating.