Adding code for segment tree construction and querying