educative.io

How will we find the grid for a given location

How will we find the grid for a given location? We will start with the root node and search downward to find our required node/grid. At each step, we will see if the current node we are visiting has children. If it has, we will move to the child node that contains our desired location and repeat this process. If the node does not have any children, then that is our desired node.
how do we move to the child node that contains our desired location. is there data in the child nodes that help us do this?

Hi @Dewey_Munoz!

The children nodes contain location data, as specified earlier in the lesson. So, once we start at the root node, we check the location data stored in the node. If we don’t find the location, we move to the children nodes (if there are any). If not, we use the current node we are at as the desired node.

I hope this helps!

1 Like

Can you please explain what location data will you match while traversing the tree?
Is this (lat,long), if yes, that means Are we saving literally all the possible locations of the every user on the planet on earth?