educative.io

When to terminate nearby places search in dynamic grid approach?

Hi @Design_Gurus

How to terminate search in dyanmic grid search?

  1. If we use Doubly Linked List approach, you see a leaf nodes,prev and next, how long will you go,?If you stop by radius threshold, it is possible that the current node does not fall in radius but the next to that falls?How will u handle this case?Also it is possible if u stop by 500 places, then the next nodes may have more relevant nodes,how will u handles such cases?What is the criteria to terminate looking for places?

  2. If we got by parent pointer approach, then it is possible that current nodes sibling dont lie in range but, grand parent or grand grand parent sibling has a node in range, you will you terminate as you dont know till which level to go till top?

Both approaches seems does not handle this case

Hey @rahul9!
Your question is not clear. Could you please add more explanation with some examples?