0 day streak

Ride sharing

A ride-sharing system like Uber or Lyft matches a rider with a nearby available driver within seconds, while hundreds of thousands of drivers send their location every few seconds. The heart of it is a geospatial index: the map is split into cells, using a geohash (a short code where nearby places share a prefix) or a quadtree (squares that subdivide where drivers are dense), so “who is near me?” means checking a few cells instead of every driver. Those constantly changing locations live in fast in-memory stores rather than the main database. The other interesting part is matching itself: offering a ride to one driver at a time, handling declines and timeouts, and never assigning the same driver twice.

In this lesson: Geohash and quadtree on a live map.