Problem I have to support Q queries of a set of n 2-D points in Cartesian plane lying in [0,M]x[0,M]. Points are given in advance.
Each query ask me to count the number of points enclosed in rectangle (x1,y1)*(x2,y2). (axis aligned rectangle).
constraints
0 < M < 10000
I want to know more about the algorithms used. Can we perform these queries more efficiently using this information that all the points and the queries are given in advance and the coordinates of points are bounded etc.
Variant: Instead of n points to begin with, Can we add n axis-aligned rectangular patches of points as n add operation in our data structure and then answer the same queries. [lazy segment trees kind of approach].