Range Search

Range Tree

First introduced in CS240.

Both Quadtrees and kd-Trees are intuitive and simple. However, they both may be very slow for range searches. Quadtrees are also potentially wasteful in space.

This is where we introduce Range trees, a “Tree of trees”.

Primary structure: Balanced binary search tree that stores and uses -coordinates as keys.

Every node of stores an associate structure :

  • Let be all points in subtree of in (including point at )
  • stores in a balanced binary search tree, using the -coordinates as key
  • Note: is not necessarily the root of

  • These operations are a little hard to wrap your ahead around, but make sure to understand

First, you must understand how range search works on BSTs.

But the coolest part about range trees is being able to do range search, which you can do like this:

  • AHHH YES, I GET IT LETS GOOOO I UNDERSTAND HOW THIS WORKSSS

When to use Quadtrees vs. kd-Trees vs Range Trees?

They are all Tradeoffs. Look at this set of slides: