algorithm for searching in ranges
I am given a huge list of objects with attributes x and y. We are require开发者_运维技巧d to search for all objects lying between a given upper and lower bound of both the attributes.
I was wondering if there is an efficient algorithm to implement this.
Thanks!
There are standard algorithms for this. See http://en.wikipedia.org/wiki/R-tree for one.
A quadtree or a spatial index (a space-filling curve, for example a hilbert curve).
精彩评论