are you sure given tree is binary tree and not BST.
if it is BST then we can search start node and then do inorder traversal
from there.
before thinking printing abt upward node...please confirm if it a binary
tree or BST.

On Tue, Jan 31, 2012 at 9:27 PM, Dhirendra Singh <dps...@gmail.com> wrote:

>
> You are given a function printKDistanceNodes which takes in a root node of
> a binary tree, a start node and an integer K. Complete the function to
> print the value of all the nodes (one-per-line) which are a K distance from
> the given start node in sorted order. Distance can be upwards or downwards.
>
>
> anyone any idea ?? how to print nodes above the specified node,
>
> Note : we do not have a reference to parent
>
>
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to