Quadtrees for dense neighborhoods
medium 4 minA point-region quadtree divides a region into four quadrants and recursively subdivides busy regions.
Video lesson · Chapter 1 of 5
The fifth restaurant arrives
The seventeenth charger splits the city block
1:16Reel
Theory
Read or listen first. About 1 min.
What it is
A point-region quadtree stores points in leaves. An overflowing leaf subdivides into four quadrants, and its points move into the appropriate children.
Split the crowded bucket
Why it exists
This concentrates index detail in a busy district. Sparse regions remain cheap to traverse, and queries can skip branches that lie outside the search area.
Words to know
- Leaf capacity
- The occupancy threshold used by a bucketed quadtree to decide whether to subdivide.
How it works
Step through the idea, or press Play.
Fill a bucket. Sixteen chargers occupy a bounded district.
Understand it
Worked example
Quadtrees for dense neighborhoods in practice
A city district exceeds a bucket limit of sixteen chargers while an equally large rural quadrant holds two. Subdivide the city bucket. A query in the rural area can skip the entire city subtree.
Related case
Find every charger across a cell boundary
A driver near the edge of a grid cell requests chargers within 800 metres. The closest charger sits across the street in another cell.
Fetch intersecting cells and check candidates.