qodebase logoqodebase
← All tracks

Unit 2 — geo-indexing, k-d trees, quad-trees, H3, and ETA ranking

Nearest Drivers & Spatial Indexing

A rider drops a pin. Within ~50 milliseconds you must answer a deceptively simple question: which drivers should we even consider for this trip? Thousands of cars are online in the metro, the answer changes every second as they move, and "closest" is a trap — the car 200 m away may be across a bay with no bridge, while the genuinely fastest pickup is a kilometre down a highway on-ramp.

This unit builds the candidate-retrieval layer that sits between routing (Unit 1) and dispatch (Unit 3). You will implement four things from scratch — a uniform-grid filter, a k-d tree, a quad-tree, and a two-stage ETA pipeline — run them against fixtures with python test.py, and answer deterministic checkpoints to unlock each step.