title: print all nodes at a distance of 'x' from a given node in BST
body: <p>The detailed question is to find all the nodes with distance x( i.e. number of edges =x) from a given node .</p>
  
  <p>I was asked in an Amazon Interview today, </p>
  
  <pre><code>void findNodeWithDistanceX(struct node* root,struct node * qnode, int value)
  {
      //root is root Node, qnode is questionnode from which distance to be calculated, value is the            
      //distance to be calculated
  
  
      //finding distance between root and qnode
      int distance = findDistancefromRoot(root ,qnode);
  
      if(distance&gt; value)
      {
          traverseDistancedown(root ,distance-value);
      }
  
      if(distance ==value){
          printf("%d",root-&gt;value);
      }
  
      // Traverse and find all nodes with distance value from 'qnode' down the tree
      traverseDistancedown(qnode,value);
  </code></pre>
  
  <p>Now In case of finding the distance "value"  from qnode .<br>
  I did not get the answer how to traverse up the Tree and satisfy the condition of distance with value.</p>
  
  <p>Although many cases arises here.</p>
  
  <p>I tried backtracking from qnode but to no avail I was unable to impress him and unable to write the Code.</p>
  
  <p>Any Discussion regarding implementing the traversal up the tree will be helpful to me.</p>