educative.io

Grid Based Search Algo

If the grid size is equal to the distance we want to query, then we only need to search within the grid which contains the given location and neighboring eight grids.

My Question:
Why do we have to search for neighboring eight grids if the required distance is equal to the grid size?

So, we are searching in the neighbouring eight grids as we have given a specific radius. So, if your location is in the centre of the grid then we have to look in the neighbouring grids to make it a proper grid and in that radius