i didn’t understand this video how the algo is implemented??
Binary tree- nodes at a distance from node
@ashutoshu hey is question me hme ek target node di hui hai hme us node se k distance pr jitni bhi node hai woh print krni hai chahe woh us node ke parent wale subtree me ho ya us node ke khud ke subtree me ho to yhi do cases bnte hai ,agr finding node hmari target node ke subtree me hogi to hm seedha recursion se k distance pr jake call krke find kr skte hai ,but 2nd case me agr finding node target node ke parent ke subtree me ho to hmare pass parent pointer to nhi hai to hm upr nhi ja skte ,islie hm root se hi start krrhe hai agr hmari target node is node se r+1 dist pr hai ye hmne assume kia hai l+1 dis aur finding node hmare is node ke right subtree me hai to hme us node ke k-r-1 distance pr search krna hai and vice versa agr left me hai to k-l-1 pr search krna hai.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.