Apex › Storage & databases

k-d tree — nearest-neighbor search

A tree that indexes points in space so you find the nearest one without checking them all. It splits the plane recursively — vertical, then horizontal, alternating — giving each point a rectangle, and a query skips any rectangle on the far side of a split that's already too far. Click to move the query and watch how few points it actually checks.

More in Storage & databases