John said:
Thanks.
Yes. It is a geographic map, a 2-D plane with many points. Each point
has coordinates, (x,y). But the points are not evenly distributed. So
it is not a uniform grid. The operations are: insertion( add new
points), deletion( remove existing points), lookup( given a point,
output its coordinates), and searching (given a point, ouput its
neighbor points). Hope I have clearly described the problem. Any
suggestion is appreciated.
I am still not clear on "neighbour points" in this context - does this mean,
all points within a certain radius ?
There are a few different data structures which might be useful (probably
off topic now :-o ):
- a 2D grid of "bins" (a list of points for each grid cell), similar to a
hash table - point x, y maps to bin[x / CELL_SIZE][y / CELL_SIZE]. To search
for points near point P, iterate through the points in P's bin and the 8
adjacent bins (assuming you are only interesting in points within a distance
of CELL_SIZE from P)
- Quad Trees are a great recursive data structure for uneven distributions
of points ("bins" are only good for reasonably scattered distributions).
These are like a binary tree in two dimensions (with four children instead
of two)
- search for "spatial data structures" with google for others
Hope this is helpful,
David F