NeoAlgo icon indicating copy to clipboard operation
NeoAlgo copied to clipboard

Finding all the nodes at a distance 'k' from a given node in a Binary Tree

Open shankhanil007 opened this issue 6 years ago • 5 comments

🚀 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

shankhanil007 avatar Aug 16 '20 04:08 shankhanil007

I would like to solve this issue in C++ as a part of Hackin Codes 2020

shankhanil007 avatar Aug 16 '20 04:08 shankhanil007

I would like to solve this issue in Java as a part of HakinCodes 2020. Please assign it to me :) @Kajol-Kumari @siddharth25pandey

Nistha-tech avatar Aug 16 '20 05:08 Nistha-tech

This seems an interesting question. I would like to solve this in Python.

TechTarun avatar Aug 16 '20 05:08 TechTarun

I would like to solve this issue in C as a part of HakinCodes 2020. Please assign it to me :) @Kajol-Kumari @siddharth25pandey

yashaswibiyahut avatar Aug 24 '20 11:08 yashaswibiyahut

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!

github-actions[bot] avatar Oct 24 '20 00:10 github-actions[bot]