Segment tree

You are given an array of size N.There are m query in format 1 x .for each query we have to answer number of element smaller than x?

I know this question can we solved by using sorting and binary search.

Now i want to solve this question using segment tree…i want to understand this blog

for this question you better use fenwich tree. which is much faster than segment tree because it deal with binary.