Finding all the nodes at a distance 'k' from a given node in a Binary Tree
🚀 Feature
Given a binary tree, a target node in the binary tree, and an integer value k, print all the nodes that are at a distance k from the given target node.
Have you read the Contributing Guidelines on Pull Requests?
Yes!
Motivation
Binary Tree is a special tree whose each node has at max two nodes. The above problem can be solved in O(N) time complexity and approach to the solution clears a lot of good concepts about binary tree.
Pitch
The problem should be solved in O(N) time complexity and O(N) space complexity. It can be solved using Graph or DFS. Answer should be a list of the values of all nodes that have a distance K from the given target node.
Assignees
- C++: @shankhanil007
- Java: @Nistha-Tech
- Python: @TechTarun
I would like to solve this issue in C++ as a part of Hackin Codes 2020
I would like to solve this issue in Java as a part of HakinCodes 2020. Please assign it to me :) @Kajol-Kumari @siddharth25pandey
This seems an interesting question. I would like to solve this in Python.
I would like to solve this issue in C as a part of HakinCodes 2020. Please assign it to me :) @Kajol-Kumari @siddharth25pandey
Please reopen this issue once you add more information and updates here. If this is not the case and you need some help, feel free to seek help from our Telegram or ping one of the reviewers. Thank you for your contributions!