Canonic implementation of Segment tree