title: Fill a binary tree with two functions
body: <p>I need to implement a binary tree in java, where the value of a right node is calculated with function1() which takes the parent and parent of parent nodes as input and the value of a  left node is calculated with function2() which takes the parent node as input. (for the first two child nodes, parent and parent of parent node values are pre-determined) 
  The nodes are filled with the return values of their respective functions until one of the nodes has the value which the program is looking for. If the functions produce the desired value at some point, we need to print the path to that node, that is which order of functions produced the desired value. If the value is impossible to get with the given functions then we print out "false"</p>
  
  <p>Could you please tell me the best way to implement this algorithm? </p>
  
  <p>Edit: let's assume that:
  1. function1 is : </p>
  
  <pre><code>int function1(p_node.value, p_node.p_node.value)
  { `return 5*p_node.value+6*p_node.p_node.value;}
  </code></pre>
  
  <p>2: function2 is:</p>
  
  <pre><code>int function2(p_node.value){
  return 5*p_node;}
  </code></pre>
  
  <p>Then,</p>
  
  <pre><code>node.right_node.value=function1(node.p_node.value, node.p_node.pnode.value)
  if(node.right_node.value==desired_output) "print path_to_the_node"
  node.left_node.value=function2(node.p_node.value);
  if(node.left_node.value==desired_output) "print path_to_the_node"
  </code></pre>