segment tree and binary index tree