add first implementation of segment tree.