Search code examples
algorithmsearchrangearray-algorithms

algorithm for searching in ranges


I am given a huge list of objects with attributes x and y. We are required 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!


Solution

  • A quadtree or a spatial index (a space-filling curve, for example a hilbert curve).