A binary tree node has data , pointer to left child and a pointer to right child
public class Node { public int data ; public Node left , right ; public Node ( int item ) { data = item ; left = right = null ; } } public class BinaryTree { public Node root ; public virtual void printKDistant ( Node node , int k ) { if ( node == null k < 0 ) { return ; } if ( k == 0 ) { Console . Write ( node . data + " ▁ " ) ; return ; } printKDistant ( node . left , k - 1 ) ; printKDistant ( node . right , k - 1 ) ; }