This content originally appeared on DEV Community and was authored by Sanket Kalekar
Have you ever wondered how Uber magically finds a driver near you within seconds of booking a ride?🤔
where my night 2AM brain cells are decoding this after some of research i got this:
So suppose this is you🧍and these are the drivers around you
Uber uses a thing called hexagonal index So what it does is it divides the entire map into hexagons So you are in a hexagon So it will search in all the hexagons that are near you to see if it finds a driver or not
Now it is possible that you are covering a lot of area and we have to find more drivers nearby So what it does is it breaks these hexagons into smaller hexagons so that it will be able to find very close drivers,
So simply you can imagine how it will be suppose we first looked at the big hexagons to see how many are there around you this is how it works.
but still in confuse why hexagons why not did we use triangles and squares?
if you look at one hexagon, the adjacent hexagon the distance will be equidistant if you look at it from the center but this doesn't happen in a square or triangle now how are these hexagons stored?
This content originally appeared on DEV Community and was authored by Sanket Kalekar
Sanket Kalekar | Sciencx (2024-09-13T10:18:11+00:00) The Hexagonal Code: How Uber Finds You Fast!. Retrieved from https://www.scien.cx/2024/09/13/the-hexagonal-code-how-uber-finds-you-fast/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.